Skip to contentSkip to conversation

hwmon: (pmbus) Simplify the calculation of variables

PATCH Applied Jiapeng Zhong 2 participants 2 messages Jan 26, 2021 – Jan 28, 2021 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (pmbus) Simplify the calculation of variables

Fix the following coccicheck warnings:

./drivers/hwmon/pmbus/pmbus_core.c:1265:24-26: WARNING !A || A && B is equivalent to !A || B.

---
 drivers/hwmon/pmbus/pmbus_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus_core.c +1 -1
index 192442b..a78ae70 100644
@@ -1262,7 +1262,7 @@ static int pmbus_add_sensor_attrs_one(struct i2c_client *client,
 		 * which global bit is set) for this page is accessible.
 		 */
 		if (!ret && attr->gbit &&
-		    (!upper || (upper && data->has_status_word)) &&
+		    (!upper || data->has_status_word) &&
 		    pmbus_check_status_register(client, page)) {
 			ret = pmbus_add_boolean(data, name, "alarm", index,
 						NULL, NULL,
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 7 lines · Jiapeng Zhong

Fix the following coccicheck warnings:

./drivers/hwmon/pmbus/pmbus_core.c:1265:24-26: WARNING !A || A && B is equivalent to !A || B.

Applied.

Thanks,
Guenter

Quoted 17 lines
---
 drivers/hwmon/pmbus/pmbus_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus_core.c +1 -1
index 192442b..a78ae70 100644
@@ -1262,7 +1262,7 @@ static int pmbus_add_sensor_attrs_one(struct i2c_client *client,
 		 * which global bit is set) for this page is accessible.
 		 */
 		if (!ret && attr->gbit &&
-		    (!upper || (upper && data->has_status_word)) &&
+		    (!upper || data->has_status_word) &&
 		    pmbus_check_status_register(client, page)) {
 			ret = pmbus_add_boolean(data, name, "alarm", index,
 						NULL, NULL,