From: Chen Ni Date: Thu, 20 Mar 2025 06:39:56 +0000 (+0800) Subject: pcmcia: omap: Add missing check for platform_get_resource X-Git-Tag: v6.12.46~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=278842aca27e48fab1d41529281e7e7b90eaec34;p=thirdparty%2Fkernel%2Fstable.git pcmcia: omap: Add missing check for platform_get_resource [ Upstream commit ecef14f70ec9344a10c817248d2ac6cddee5921e ] Add missing check for platform_get_resource() and return error if it fails to catch the error. Fixes: d87d44f7ab35 ("ARM: omap1: move CF chipselect setup to board file") Signed-off-by: Chen Ni Signed-off-by: Dominik Brodowski Signed-off-by: Sasha Levin --- diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index 80137c7afe0d9..5b639c942f17a 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c @@ -215,6 +215,8 @@ static int __init omap_cf_probe(struct platform_device *pdev) return -EINVAL; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; cf = kzalloc(sizeof *cf, GFP_KERNEL); if (!cf)