OSDN Git Service

power: supply: qcom: Remove useless NULL checks against thresh array in msm_bcl_enable
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 27 Sep 2019 06:14:04 +0000 (23:14 -0700)
committerNathan Chancellor <natechancellor@gmail.com>
Fri, 27 Sep 2019 07:42:37 +0000 (00:42 -0700)
Clang warns:

../drivers/power/supply/qcom/msm_bcl.c:230:42: warning: address of array
'bcl[BCL_PARAM_VOLTAGE]->thresh' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (!bcl[i] || !bcl[BCL_PARAM_VOLTAGE]->thresh
                       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
../drivers/power/supply/qcom/msm_bcl.c:231:31: warning: address of array
'bcl[BCL_PARAM_CURRENT]->thresh' will always evaluate to 'true'
[-Wpointer-bool-conversion]
                || !bcl[BCL_PARAM_CURRENT]->thresh) {
                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
2 warnings generated.

Fixes: 77dd35597191 ("qpnp: Add snapshot of some qpnp, regulator and charger drivers")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
drivers/power/supply/qcom/msm_bcl.c

index aea3f46..b4347ee 100644 (file)
@@ -227,8 +227,7 @@ int msm_bcl_enable(void)
        int ret = 0, i = 0;
        struct bcl_param_data *param_data = NULL;
 
-       if (!bcl[i] || !bcl[BCL_PARAM_VOLTAGE]->thresh
-               || !bcl[BCL_PARAM_CURRENT]->thresh) {
+       if (!bcl[i]) {
                pr_err("BCL not initialized\n");
                return -EINVAL;
        }