diff mbox

[28/38] video/omap: remove invalid check

Message ID 1442842450-29769-29-git-send-email-a.hajda@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrzej Hajda Sept. 21, 2015, 1:34 p.m. UTC
regno is unsigned so it cannot be negative.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/video/fbdev/omap/omapfb_main.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Tomi Valkeinen Sept. 24, 2015, 10:48 a.m. UTC | #1
On 21/09/15 16:34, Andrzej Hajda wrote:
> regno is unsigned so it cannot be negative.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
>  drivers/video/fbdev/omap/omapfb_main.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
> index 1fb3ea3..393ae1b 100644
> --- a/drivers/video/fbdev/omap/omapfb_main.c
> +++ b/drivers/video/fbdev/omap/omapfb_main.c
> @@ -276,11 +276,6 @@ static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green,
>  		if (r != 0)
>  			break;
>  
> -		if (regno < 0) {
> -			r = -EINVAL;
> -			break;
> -		}
> -
>  		if (regno < 16) {
>  			u16 pal;
>  			pal = ((red >> (16 - var->red.length)) <<
> 

Thanks, queued for 4.4.

 Tomi
diff mbox

Patch

diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
index 1fb3ea3..393ae1b 100644
--- a/drivers/video/fbdev/omap/omapfb_main.c
+++ b/drivers/video/fbdev/omap/omapfb_main.c
@@ -276,11 +276,6 @@  static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green,
 		if (r != 0)
 			break;
 
-		if (regno < 0) {
-			r = -EINVAL;
-			break;
-		}
-
 		if (regno < 16) {
 			u16 pal;
 			pal = ((red >> (16 - var->red.length)) <<