]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rtc: ds1374: Merge conditional + WARN_ON()
authorSrikant Ritolia <s.ritolia@samsung.com>
Tue, 29 Nov 2016 11:04:37 +0000 (11:04 +0000)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Wed, 7 Dec 2016 15:34:43 +0000 (16:34 +0100)
WARN_ON does both these things in one statement.
Using a better pattern with WARN_ON().

Signed-off-by: Srikant Ritolia <s.ritolia@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1374.c

index 3b3049c8c9e04ddb8ebfb3c391eba41b320286f3..52429f0a57cc2125e428aa88be917a4268f44b35 100644 (file)
@@ -89,10 +89,8 @@ static int ds1374_read_rtc(struct i2c_client *client, u32 *time,
        int ret;
        int i;
 
-       if (nbytes > 4) {
-               WARN_ON(1);
+       if (WARN_ON(nbytes > 4))
                return -EINVAL;
-       }
 
        ret = i2c_smbus_read_i2c_block_data(client, reg, nbytes, buf);