hwmon: (scmi) Remove redundant pointer check
authorNathan Chancellor <natechancellor@gmail.com>
Sun, 16 Sep 2018 00:05:07 +0000 (17:05 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 11 Oct 2018 03:37:13 +0000 (20:37 -0700)
Clang warns when the address of a pointer is used in a boolean context
as it will always return true.

drivers/hwmon/scmi-hwmon.c:59:24: warning: address of array
'sensor->name' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (sensor && sensor->name)
                   ~~ ~~~~~~~~^~~~
1 warning generated.

Remove the check as it isn't doing anything currently; if validation
of the contents of the data structure was intended by the original
author (since this line has been present from the first version of
this driver), it can be added in a follow-up patch.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/scmi-hwmon.c

index 91976b6..2e005ed 100644 (file)
@@ -56,7 +56,7 @@ scmi_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_types type,
        const struct scmi_sensors *scmi_sensors = drvdata;
 
        sensor = *(scmi_sensors->info[type] + channel);
-       if (sensor && sensor->name)
+       if (sensor)
                return S_IRUGO;
 
        return 0;