Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

w1: w1_therm: use clamp() in int_to_short()

It's slightly cleaner to use the clamp() macro instead of open coding
this.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YEedHNwqEH8fvjkD@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
199c4d0e f6d706dd

+1 -2
+1 -2
drivers/w1/slaves/w1_therm.c
··· 906 906 static inline s8 int_to_short(int i) 907 907 { 908 908 /* Prepare to cast to short by eliminating out of range values */ 909 - i = i > MAX_TEMP ? MAX_TEMP : i; 910 - i = i < MIN_TEMP ? MIN_TEMP : i; 909 + i = clamp(i, MIN_TEMP, MAX_TEMP); 911 910 return (s8) i; 912 911 } 913 912