w1: ds2482: do not use assignment in if condition
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sat, 15 Apr 2023 10:42:57 +0000 (12:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 12:15:07 +0000 (14:15 +0200)
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>
Link: https://lore.kernel.org/r/20230415104304.104134-9-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/masters/ds2482.c

index cc5938f..c1de8a9 100644 (file)
@@ -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;
        }