hwrng: geode - fix return value check in mod_init()
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 16 Sep 2016 01:50:01 +0000 (01:50 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 22 Sep 2016 10:27:49 +0000 (18:27 +0800)
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Fixes: 6e9b5e76882c ("hwrng: geode - Migrate to managed API")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/geode-rng.c

index 0cae21086c056470e13bfcebdd7e42cb4c6b2d79..e7a2459420291b6b931b285fe2b9be22cdd3e897 100644 (file)
@@ -95,8 +95,8 @@ static int __init mod_init(void)
                                return -ENODEV;
 
                        mem = devm_ioremap(&pdev->dev, rng_base, 0x58);
-                       if (IS_ERR(mem))
-                               return PTR_ERR(mem);
+                       if (!mem)
+                               return -ENOMEM;
                        geode_rng.priv = (unsigned long)mem;
 
                        pr_info("AMD Geode RNG detected\n");