[PATCH] bus: fsl-mc: Check return value of platform_get_resource()
Markus Elfring
Markus.Elfring at web.de
Mon Jul 28 02:24:54 AEST 2025
> platform_get_resource() returns NULL in case of failure, so check its
> return value and propagate the error in order to prevent NULL pointer
> dereference.
How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16-rc7#n145
…
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -1105,6 +1105,10 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
> * Get physical address of MC portal for the root DPRC:
> */
> plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +
> + if (!plat_res)
> + return -ENODEV;
…
I suggest to omit a blank line before the if statement.
Regards,
Markus
More information about the Linuxppc-dev
mailing list