mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
dmaengine: sun6i: use of_device_get_match_data
The usage of of_device_get_match_data reduce the code size a bit. Furthermore, it prevents an improbable dereference when of_match_device() return NULL. Acked-by: Maxime Ripard <[email protected]> Signed-off-by: Corentin Labbe <[email protected]> Signed-off-by: Vinod Koul <[email protected]>
This commit is contained in:
parent
2bd6bf03f4
commit
8f3b00347b
1 changed files with 2 additions and 4 deletions
|
|
@ -1064,7 +1064,6 @@ MODULE_DEVICE_TABLE(of, sun6i_dma_match);
|
|||
|
||||
static int sun6i_dma_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct of_device_id *device;
|
||||
struct sun6i_dma_dev *sdc;
|
||||
struct resource *res;
|
||||
int ret, i;
|
||||
|
|
@ -1073,10 +1072,9 @@ static int sun6i_dma_probe(struct platform_device *pdev)
|
|||
if (!sdc)
|
||||
return -ENOMEM;
|
||||
|
||||
device = of_match_device(sun6i_dma_match, &pdev->dev);
|
||||
if (!device)
|
||||
sdc->cfg = of_device_get_match_data(&pdev->dev);
|
||||
if (!sdc->cfg)
|
||||
return -ENODEV;
|
||||
sdc->cfg = device->data;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
sdc->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
|
|
|
|||
Loading…
Reference in a new issue