From: Lars-Peter Clausen Date: Fri, 5 Oct 2012 00:14:01 +0000 (-0700) Subject: drivers/rtc/rtc-spear.c: fix several error checks X-Git-Tag: omap-for-v3.7-rc1/fixes-cpufreq-signed~12^2~90 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a16e8393ac03cc24fd9b838f42823b4242ceac88;p=pandora-kernel.git 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: // @@ type T; unsigned T i; @@ ( *i < 0 | *i >= 0 ) // Signed-off-by: Lars-Peter Clausen Cc: Viresh Kumar Cc: Alessandro Zummo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed