Re: [PATCH] smiapp: Fix BUG_ON() on an impossible condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ricardo,

Thanks for the patch.

I've removed LKML from cc since I don't think this is anything but noise
there.

On Wed, Nov 06, 2013 at 03:21:30PM +0100, Ricardo Ribalda Delgado wrote:
> internal_csi_format_idx and csi_format_idx are unsigned integers,
> therefore they can never be nevative.
> 
> CC      drivers/media/i2c/smiapp/smiapp-core.o
> In file included from include/linux/err.h:4:0,
>                  from include/linux/clk.h:15,
>                  from drivers/media/i2c/smiapp/smiapp-core.c:29:
> drivers/media/i2c/smiapp/smiapp-core.c: In function ‘smiapp_update_mbus_formats’:
> include/linux/kernel.h:669:20: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>  #define min(x, y) ({    \
>                     ^
> include/linux/compiler.h:153:42: note: in definition of macro ‘unlikely’
>  # define unlikely(x) __builtin_expect(!!(x), 0)
>                                           ^
> drivers/media/i2c/smiapp/smiapp-core.c:402:2: note: in expansion of macro ‘BUG_ON’
>   BUG_ON(min(internal_csi_format_idx, csi_format_idx) < 0);
>   ^
> drivers/media/i2c/smiapp/smiapp-core.c:402:9: note: in expansion of macro ‘min’
>   BUG_ON(min(internal_csi_format_idx, csi_format_idx) < 0);
>          ^
> 
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@xxxxxxxxx>
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index ae66d91..fbd48f0 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -399,7 +399,6 @@ static void smiapp_update_mbus_formats(struct smiapp_sensor *sensor)
>  
>  	BUG_ON(max(internal_csi_format_idx, csi_format_idx) + pixel_order
>  	       >= ARRAY_SIZE(smiapp_csi_data_formats));
> -	BUG_ON(min(internal_csi_format_idx, csi_format_idx) < 0);
>  
>  	dev_dbg(&client->dev, "new pixel order %s\n",
>  		pixel_order_str[pixel_order]);

I wonder how this hasn't been noticed before. :-) No harm done, though.

Acked-by: Sakari Ailus <sakari.ailus@xxxxxx>

Should I take the patch to my tree? I don't think I have other pending
patches for smiapp so I'm fine that you have it in yours, too.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux