CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Evgeniy Polyakov CC: "Greg Kroah-Hartman" CC: Dan Carpenter CC: Bhaskar Chowdhury CC: Ivan Zaentsev CC: Randy Dunlap CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/w1/slaves/w1_therm.c:1840:18-19: WARNING opportunity for swap() Check for opencoded swap() implementation. Generated by: scripts/coccinelle/misc/swap.cocci CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 6f513529296fd4f696afb4354c46508abe646541 commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap script :::::: branch date: 13 hours ago :::::: commit date: 7 months ago Please take the patch only if it's a positive warning. Thanks! w1_therm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -1836,9 +1836,9 @@ static ssize_t alarms_store(struct devic 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