All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] video: comparing unsigned with negative 0
@ 2010-04-07  9:41 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2010-04-07  9:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Guennadi Liakhovetski, Kuninori Morimoto, Magnus Damm,
	Hans Verkuil, linux-media, kernel-janitors

soc_mbus_bytes_per_line() returns -EINVAL on error but we store it in an
unsigned int so the test for less than zero doesn't work.  I think it
always returns "small" positive values so we can just cast it to int
here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 6e16b39..1ad980f 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -1633,7 +1633,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
 	height = pix->height;
 
 	pix->bytesperline = soc_mbus_bytes_per_line(width, xlate->host_fmt);
-	if (pix->bytesperline < 0)
+	if ((int)pix->bytesperline < 0)
 		return pix->bytesperline;
 	pix->sizeimage = height * pix->bytesperline;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [patch] video: comparing unsigned with negative 0
@ 2010-04-07  9:41 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2010-04-07  9:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Guennadi Liakhovetski, Kuninori Morimoto, Magnus Damm,
	Hans Verkuil, linux-media, kernel-janitors

soc_mbus_bytes_per_line() returns -EINVAL on error but we store it in an
unsigned int so the test for less than zero doesn't work.  I think it
always returns "small" positive values so we can just cast it to int
here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 6e16b39..1ad980f 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -1633,7 +1633,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
 	height = pix->height;
 
 	pix->bytesperline = soc_mbus_bytes_per_line(width, xlate->host_fmt);
-	if (pix->bytesperline < 0)
+	if ((int)pix->bytesperline < 0)
 		return pix->bytesperline;
 	pix->sizeimage = height * pix->bytesperline;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-07  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-07  9:41 [patch] video: comparing unsigned with negative 0 Dan Carpenter
2010-04-07  9:41 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.