From: Geordan Neukum Date: Sun, 26 May 2019 01:18:33 +0000 (+0000) Subject: staging: kpc2000: kpc_i2c: fail probe if unable to map I/O space X-Git-Tag: v5.4-rc1~602^2~376 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e621c8a108ede08e6ff66524b4a4f756f66e5eeb;p=platform%2Fkernel%2Flinux-rpi.git staging: kpc2000: kpc_i2c: fail probe if unable to map I/O space The kpc2000 driver does not verify whether or not mapping the I/O space succeeded during probe time. Make the driver verify that the mapping operation was successful before potentially using that area in the future. Signed-off-by: Geordan Neukum Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c b/drivers/staging/kpc2000/kpc2000_i2c.c index 452052b..51e9165 100644 --- a/drivers/staging/kpc2000/kpc2000_i2c.c +++ b/drivers/staging/kpc2000/kpc2000_i2c.c @@ -591,6 +591,8 @@ static int pi2c_probe(struct platform_device *pldev) return -ENXIO; priv->smba = (unsigned long)ioremap_nocache(res->start, resource_size(res)); + if (!priv->smba) + return -ENOMEM; platform_set_drvdata(pldev, priv);