regulator: mpq7920: Check the correct variable in mpq7920_regulator_register()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 13 Jan 2020 12:59:33 +0000 (15:59 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 13 Jan 2020 15:02:48 +0000 (15:02 +0000)
There is a typo in the error checking.  We should be checking
"->rdev[i]" instead of just "->rdev".

Fixes: 6501c1f54a17 ("regulator: mpq7920: add mpq7920 regulator driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200113125805.xri6jqoxy2ldzqyg@kili.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/mpq7920.c

index ab1b847c57e570fcf8e09d4b9fe404ab356786a8..80f3131f0d1b49a32e5391d11c0c320ef7be514e 100644 (file)
@@ -274,8 +274,8 @@ static inline int mpq7920_regulator_register(
 
                info->rdev[i] = devm_regulator_register(info->dev, rdesc,
                                         config);
-               if (IS_ERR(info->rdev))
-                       return PTR_ERR(info->rdev);
+               if (IS_ERR(info->rdev[i]))
+                       return PTR_ERR(info->rdev[i]);
        }
 
        return 0;