diff mbox series

[08/15] w1: ds2482: do not use assignment in if condition

Message ID 20230415104304.104134-9-krzysztof.kozlowski@linaro.org (mailing list archive)
State Not Applicable
Headers show
Series [01/15] w1: ds2408: drop kerneldoc annotation | expand

Commit Message

Krzysztof Kozlowski April 15, 2023, 10:42 a.m. UTC
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@linaro.org>
---
 drivers/w1/masters/ds2482.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index 7e915b71045d..f4ad644a7abf 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -451,7 +451,8 @@  static int ds2482_probe(struct i2c_client *client)
 				     I2C_FUNC_SMBUS_BYTE))
 		return -ENODEV;
 
-	if (!(data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL))) {
+	data = kzalloc(sizeof(struct ds2482_data), GFP_KERNEL);
+	if (!data) {
 		err = -ENOMEM;
 		goto exit;
 	}