Skip to content

Commit cd7dea5

Browse files
alexdewarbroonie
authored andcommitted
ASoC: omap-mcbsp: Fix use of uninitialised pointer
Commit 9c34d02 ("ASoC: omap-mcbsp: Re-arrange files for core McBSP and Sidetone function split"), in rearranging various files, also replaced calls to platform_get_resource_by_name() + devm_ioremap_resource() with a single call to devm_platform_ioremap_resource_byname(). However, the struct resource is needed as we access its members so at present a null pointer is dereferenced. Fix by doing things the old way. Fixes: 9c34d02 ("ASoC: omap-mcbsp: Re-arrange files for core McBSP and Sidetone function split") Signed-off-by: Alex Dewar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dc155ad commit cd7dea5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sound/soc/ti/omap-mcbsp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,11 @@ static int omap_mcbsp_init(struct platform_device *pdev)
620620
spin_lock_init(&mcbsp->lock);
621621
mcbsp->free = true;
622622

623-
mcbsp->io_base = devm_platform_ioremap_resource_byname(pdev, "mpu");
623+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
624+
if (!res)
625+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
626+
627+
mcbsp->io_base = devm_ioremap_resource(&pdev->dev, res);
624628
if (IS_ERR(mcbsp->io_base))
625629
return PTR_ERR(mcbsp->io_base);
626630

0 commit comments

Comments
 (0)