Skip to contentSkip to conversation

drivers/hwmon: remove redundant res variable

PATCH In review [email protected] 2 participants 2 messages Jan 4, 2022 – Jan 5, 2022 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/hwmon: remove redundant res variable

From: Minghao Chi <[email protected]>

Return value from inb_p() directly instead of taking this in another redundant variable.

---
 drivers/hwmon/nct6683.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/hwmon/nct6683.c +1 -4
index 6a9f420e7d32..ab02e967f73d 100644
@@ -495,13 +495,10 @@ static inline long in_from_reg(u16 reg, u8 src)
 
 static u16 nct6683_read(struct nct6683_data *data, u16 reg)
 {
-	int res;
-
 	outb_p(0xff, data->addr + EC_PAGE_REG);		/* unlock */
 	outb_p(reg >> 8, data->addr + EC_PAGE_REG);
 	outb_p(reg & 0xff, data->addr + EC_INDEX_REG);
-	res = inb_p(data->addr + EC_DATA_REG);
-	return res;
+	return inb_p(data->addr + EC_DATA_REG);
 }
 
 static u16 nct6683_read16(struct nct6683_data *data, u16 reg)
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 8 lines · On 1/4/22 3:28 AM, [email protected] wrote:

From: Minghao Chi <[email protected]>

Return value from inb_p() directly instead of taking this in another redundant variable.

Please do not send me such patches. The subject starts with the wrong tag (it should have been "hwmon: (nct6683)", it is misleading (the variable is not redundant; if anything it is unnecessary), and the patch itself adds zero value. The submitter may have had a reason for using a variable, may it be personal style or ease of adding a debug statement when testing. There is no valid reason for changing such code.

Guenter

Quoted 24 lines
---
  drivers/hwmon/nct6683.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/hwmon/nct6683.c +1 -4
index 6a9f420e7d32..ab02e967f73d 100644
@@ -495,13 +495,10 @@ static inline long in_from_reg(u16 reg, u8 src)
 
  static u16 nct6683_read(struct nct6683_data *data, u16 reg)
  {
-	int res;
-
  	outb_p(0xff, data->addr + EC_PAGE_REG);		/* unlock */
  	outb_p(reg >> 8, data->addr + EC_PAGE_REG);
  	outb_p(reg & 0xff, data->addr + EC_INDEX_REG);
-	res = inb_p(data->addr + EC_DATA_REG);
-	return res;
+	return inb_p(data->addr + EC_DATA_REG);
  }
 
  static u16 nct6683_read16(struct nct6683_data *data, u16 reg)