mfd: pm8008: Fix return value check in pm8008_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 25 Nov 2022 07:36:26 +0000 (15:36 +0800)
committerLee Jones <lee@kernel.org>
Thu, 8 Dec 2022 14:41:29 +0000 (14:41 +0000)
In case of error, the function devm_regmap_init_i2c() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Guru Das Srinagesh <gurus@codeaurora.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221125073626.1868229-1-yangyingliang@huawei.com
drivers/mfd/qcom-pm8008.c

index 4b8ff947762f24883dd0417e3d575e4e2f653c60..9f3c4a01b4c1c4111aded086a493debedba23b8e 100644 (file)
@@ -215,8 +215,8 @@ static int pm8008_probe(struct i2c_client *client)
 
        dev = &client->dev;
        regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg);
-       if (!regmap)
-               return -ENODEV;
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
 
        i2c_set_clientdata(client, regmap);