]> Git Repo - linux.git/commitdiff
w1: w1_therm: use swap() to make code cleaner
authorYang Guang <[email protected]>
Tue, 21 Dec 2021 09:15:59 +0000 (17:15 +0800)
committerGreg Kroah-Hartman <[email protected]>
Tue, 21 Dec 2021 09:38:13 +0000 (10:38 +0100)
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: David Yang <[email protected]>
Signed-off-by: Yang Guang <[email protected]>
Link: https://lore.kernel.org/r/cb14f9e6e86cf8494ed2ddce6eec8ebd988908d9.1640077704.git.yang.guang5@zte.com.cn
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/w1/slaves/w1_therm.c

index ca70c5f032060535eb361d643d9b39717b3684c7..565578002d79ec81f1169724520e2805d4d084c3 100644 (file)
@@ -1785,7 +1785,7 @@ static ssize_t alarms_store(struct device *device,
        u8 new_config_register[3];      /* array of data to be written */
        int temp, ret;
        char *token = NULL;
-       s8 tl, th, tt;  /* 1 byte per value + temp ring order */
+       s8 tl, th;      /* 1 byte per value + temp ring order */
        char *p_args, *orig;
 
        p_args = orig = kmalloc(size, GFP_KERNEL);
@@ -1836,9 +1836,8 @@ static ssize_t alarms_store(struct device *device,
        th = int_to_short(temp);
 
        /* Reorder if required th and tl */
-       if (tl > th) {
-               tt = tl; tl = th; th = tt;
-       }
+       if (tl > th)
+               swap(tl, th);
 
        /*
         * Read the scratchpad to change only the required bits
This page took 0.054015 seconds and 4 git commands to generate.