staging: kpc2000: kpc_i2c: fail probe if unable to map I/O space
authorGeordan Neukum <gneukum1@gmail.com>
Sun, 26 May 2019 01:18:33 +0000 (01:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2019 21:04:26 +0000 (14:04 -0700)
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 <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/kpc2000/kpc2000_i2c.c

index 452052b..51e9165 100644 (file)
@@ -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);