[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230415104304.104134-7-krzysztof.kozlowski@linaro.org>
Date: Sat, 15 Apr 2023 12:42:55 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
linux-kernel@...r.kernel.org
Cc: Evgeniy Polyakov <zbr@...emap.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>, Olof Johansson <olof@...om.net>,
soc@...nel.org, linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 06/15] w1: ds2433: do not use assignment in if condition
Assignments in if condition are less readable and error-prone. Fixes
also checkpatch warning:
ERROR: do not use assignment in if condition
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
---
drivers/w1/slaves/w1_ds2433.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index 23cd099d032b..9f21fd98f799 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -98,7 +98,8 @@ static ssize_t eeprom_read(struct file *filp, struct kobject *kobj,
u8 wrbuf[3];
#endif
- if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
+ count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE);
+ if (!count)
return 0;
mutex_lock(&sl->master->bus_mutex);
@@ -208,7 +209,8 @@ static ssize_t eeprom_write(struct file *filp, struct kobject *kobj,
struct w1_slave *sl = kobj_to_w1_slave(kobj);
int addr, len, idx;
- if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
+ count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE);
+ if (!count)
return 0;
#ifdef CONFIG_W1_SLAVE_DS2433_CRC
--
2.34.1
Powered by blists - more mailing lists