diff options
author | Lars-Peter Clausen | 2012-10-05 02:14:01 +0200 |
---|---|---|
committer | Linus Torvalds | 2012-10-05 20:05:03 +0200 |
commit | a16e8393ac03cc24fd9b838f42823b4242ceac88 (patch) | |
tree | 138dac2dc48a180568e90464e561a8bae3237a89 /include/linux/mfd/rc5t583.h | |
parent | drivers/rtc/rtc-jz4740.c: fix IRQ error check (diff) | |
download | kernel-qcow2-linux-a16e8393ac03cc24fd9b838f42823b4242ceac88.tar.gz kernel-qcow2-linux-a16e8393ac03cc24fd9b838f42823b4242ceac88.tar.xz kernel-qcow2-linux-a16e8393ac03cc24fd9b838f42823b4242ceac88.zip |
drivers/rtc/rtc-spear.c: fix several error checks
There are several comparisons of a unsigned int to less than zero int
spear RTC driver. Such a check will always be true. In all these cases a
signed int is assigned to the unsigned variable, which is checked, before.
So the right fix is to make the checked variable signed as well. In one
case the check can be dropped completely, because all it does it returns
'err' if 'err' is less than zero, otherwise it returns 0. Since in this
particular case 'err' is always either 0 or less this is the same as just
returning 'err'.
The issue has been found using the following coccinelle semantic patch:
//<smpl>
@@
type T;
unsigned T i;
@@
(
*i < 0
|
*i >= 0
)
//</smpl>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Viresh Kumar <viresh.kumar@st.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mfd/rc5t583.h')
0 files changed, 0 insertions, 0 deletions