linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/omap: dsi: fix unsigned expression compared with zero
@ 2021-03-12  7:14 angkery
  2021-03-14  2:15 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: angkery @ 2021-03-12  7:14 UTC (permalink / raw)
  To: tomba, airlied, daniel, sebastian.reichel, laurent.pinchart
  Cc: dri-devel, linux-kernel, Junlin Yang

From: Junlin Yang <yangjunlin@yulong.com>

r is "u32" always >= 0,mipi_dsi_create_packet may return little than zero.
so r < 0 condition is never accessible.

Fixes coccicheck warnings:
./drivers/gpu/drm/omapdrm/dss/dsi.c:2155:5-6:
WARNING: Unsigned expression compared with zero: r < 0

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8e11612..b31d750 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2149,11 +2149,12 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int vc,
 			     const struct mipi_dsi_msg *msg)
 {
 	struct mipi_dsi_packet pkt;
+	int ret;
 	u32 r;
 
-	r = mipi_dsi_create_packet(&pkt, msg);
-	if (r < 0)
-		return r;
+	ret = mipi_dsi_create_packet(&pkt, msg);
+	if (ret < 0)
+		return ret;
 
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
-- 
1.9.1



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

* Re: [PATCH] drm/omap: dsi: fix unsigned expression compared with zero
  2021-03-12  7:14 [PATCH] drm/omap: dsi: fix unsigned expression compared with zero angkery
@ 2021-03-14  2:15 ` Laurent Pinchart
  2021-03-16 14:03   ` Tomi Valkeinen
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2021-03-14  2:15 UTC (permalink / raw)
  To: angkery
  Cc: tomba, airlied, daniel, sebastian.reichel, dri-devel,
	linux-kernel, Junlin Yang

Hi Junlin,

Thank you for the patch.

On Fri, Mar 12, 2021 at 03:14:45PM +0800, angkery wrote:
> From: Junlin Yang <yangjunlin@yulong.com>
> 
> r is "u32" always >= 0,mipi_dsi_create_packet may return little than zero.
> so r < 0 condition is never accessible.
> 
> Fixes coccicheck warnings:
> ./drivers/gpu/drm/omapdrm/dss/dsi.c:2155:5-6:
> WARNING: Unsigned expression compared with zero: r < 0
> 
> Signed-off-by: Junlin Yang <yangjunlin@yulong.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Tomi, will you take this in your tree ?

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 8e11612..b31d750 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2149,11 +2149,12 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int vc,
>  			     const struct mipi_dsi_msg *msg)
>  {
>  	struct mipi_dsi_packet pkt;
> +	int ret;
>  	u32 r;
>  
> -	r = mipi_dsi_create_packet(&pkt, msg);
> -	if (r < 0)
> -		return r;
> +	ret = mipi_dsi_create_packet(&pkt, msg);
> +	if (ret < 0)
> +		return ret;
>  
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] drm/omap: dsi: fix unsigned expression compared with zero
  2021-03-14  2:15 ` Laurent Pinchart
@ 2021-03-16 14:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2021-03-16 14:03 UTC (permalink / raw)
  To: Laurent Pinchart, angkery
  Cc: airlied, daniel, sebastian.reichel, dri-devel, linux-kernel, Junlin Yang

On 14/03/2021 04:15, Laurent Pinchart wrote:
> Hi Junlin,
> 
> Thank you for the patch.
> 
> On Fri, Mar 12, 2021 at 03:14:45PM +0800, angkery wrote:
>> From: Junlin Yang <yangjunlin@yulong.com>
>>
>> r is "u32" always >= 0,mipi_dsi_create_packet may return little than zero.
>> so r < 0 condition is never accessible.
>>
>> Fixes coccicheck warnings:
>> ./drivers/gpu/drm/omapdrm/dss/dsi.c:2155:5-6:
>> WARNING: Unsigned expression compared with zero: r < 0
>>
>> Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Tomi, will you take this in your tree ?

Thanks. Yes, I'll pick this up.

  Tomi


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

end of thread, other threads:[~2021-03-16 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  7:14 [PATCH] drm/omap: dsi: fix unsigned expression compared with zero angkery
2021-03-14  2:15 ` Laurent Pinchart
2021-03-16 14:03   ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).