Skip to contentSkip to conversation

drm/omap: dsi: fix unsigned expression compared with zero

PATCH In review angkery 3 participants 3 messages Mar 12, 2021 – Mar 16, 2021

Subsystems (3)
lore
Share & tools
lore

angkery

author
#0 lore raw

PATCH 1/1 drm/omap: dsi: fix unsigned expression compared with zero

From: Junlin Yang <[email protected]>

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

---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +4 -3
index 8e11612..b31d750 100644
@@ -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));
 
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Junlin,

Thank you for the patch.

Quoted 10 lines · angkery

From: Junlin Yang <[email protected]>

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

Tomi, will you take this in your tree ?

Quoted 24 lines
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dsi.c +4 -3
index 8e11612..b31d750 100644
@@ -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));
 
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 14 lines · Laurent Pinchart

Hi Junlin,

Thank you for the patch.

Quoted 9 lines · angkery

From: Junlin Yang <[email protected]>

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

Quoted 5 lines
Quoted 1 line

Tomi, will you take this in your tree ?

Thanks. Yes, I'll pick this up.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel