Skip to content

Commit

Permalink
dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be de…
Browse files Browse the repository at this point in the history
…referenced

Currently when the call to dev_get_platdata returns null the driver issues
a warning and then later dereferences the null pointer.  Avoid this issue
by returning -ENODEV error rather when the platform data is null and
change the warning to an appropriate error message.

Addresses-Coverity: ("Dereference after null check")
Fixes: 211010a ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Colin Ian King authored and Tony Lindgren committed Jan 13, 2020
1 parent 37b156e commit 9947726
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/dma/ti/omap-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev)
if (conf) {
od->cfg = conf;
od->plat = dev_get_platdata(&pdev->dev);
if (!od->plat)
dev_warn(&pdev->dev, "no sdma auxdata needed?\n");
if (!od->plat) {
dev_err(&pdev->dev, "omap_system_dma_plat_info is missing");
return -ENODEV;
}
} else {
od->cfg = &default_cfg;

Expand Down

0 comments on commit 9947726

Please sign in to comment.