]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
crypto: ux500 - fix checks of error code returned by devm_ioremap_resource()
authorVladimir Zapolskiy <vz@mleia.com>
Sun, 6 Mar 2016 01:22:04 +0000 (03:22 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Mar 2016 13:19:20 +0000 (21:19 +0800)
The change fixes potential oops while accessing iomem on invalid
address, if devm_ioremap_resource() fails due to some reason.

The devm_ioremap_resource() function returns ERR_PTR() and never
returns NULL, which makes useless a following check for NULL.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Fixes: 5a4eea2658c93 ("crypto: ux500 - Use devm_xxx() managed function")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ux500/cryp/cryp_core.c
drivers/crypto/ux500/hash/hash_core.c

index 4c243c1ffc7f6d32224db88bb4c79d0810d9c87d..790f7cadc1ed8764d8e98745ff5d91819bd80733 100644 (file)
@@ -1440,9 +1440,9 @@ static int ux500_cryp_probe(struct platform_device *pdev)
 
        device_data->phybase = res->start;
        device_data->base = devm_ioremap_resource(dev, res);
-       if (!device_data->base) {
+       if (IS_ERR(device_data->base)) {
                dev_err(dev, "[%s]: ioremap failed!", __func__);
-               ret = -ENOMEM;
+               ret = PTR_ERR(device_data->base);
                goto out;
        }
 
index d6fdc583ce5d934083706c70b5201da31f4fc408..574e87c7f2b8933c04242de63afce3ac65723cf3 100644 (file)
@@ -1659,9 +1659,9 @@ static int ux500_hash_probe(struct platform_device *pdev)
 
        device_data->phybase = res->start;
        device_data->base = devm_ioremap_resource(dev, res);
-       if (!device_data->base) {
+       if (IS_ERR(device_data->base)) {
                dev_err(dev, "%s: ioremap() failed!\n", __func__);
-               ret = -ENOMEM;
+               ret = PTR_ERR(device_data->base);
                goto out;
        }
        spin_lock_init(&device_data->ctx_lock);