hwmon: (pmbus) Allow phase function even if it's not on page
authorErik Rosen <erik.rosen@metormote.com>
Wed, 9 Jun 2021 09:32:07 +0000 (11:32 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 17 Jun 2021 11:21:46 +0000 (04:21 -0700)
Allow the use of a phase function even if it does not exist on
the associated page.

Signed-off-by: Erik Rosen <erik.rosen@metormote.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus_core.c

index c4f557c8955b2ed523d84f7d60c8878af008a013..776ee2237be20ad7c0af6b8b16d335d82cdf67eb 100644 (file)
@@ -1329,14 +1329,14 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client,
 
                pages = paged ? info->pages : 1;
                for (page = 0; page < pages; page++) {
-                       if (!(info->func[page] & attrs->func))
-                               continue;
-                       ret = pmbus_add_sensor_attrs_one(client, data, info,
-                                                        name, index, page,
-                                                        0xff, attrs, paged);
-                       if (ret)
-                               return ret;
-                       index++;
+                       if (info->func[page] & attrs->func) {
+                               ret = pmbus_add_sensor_attrs_one(client, data, info,
+                                                                name, index, page,
+                                                                0xff, attrs, paged);
+                               if (ret)
+                                       return ret;
+                               index++;
+                       }
                        if (info->phases[page]) {
                                int phase;