Skip to contentSkip to conversation

drm/mediatek: Remove less-than-zero comparison of an unsigned value

PATCH In review Shawn Sung 2 participants 2 messages Jun 14, 2024 – Jun 17, 2024

Subsystems (3)
lore
Share & tools
lore

Shawn Sung

author
#0 lore raw

PATCH 1/1 drm/mediatek: Remove less-than-zero comparison of an unsigned value

From: Hsiao Chien Sung <[email protected]>

Fix a Coverity error that less-than-zero comparison of an unsigned value is never true.

Fixes 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver for MT8195")
---
 drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_ddp_comp.c +1 -1
index 17b036411292..a66e46d0b45e 100644
@@ -593,7 +593,7 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	int ret;
 #endif
 
-	if (comp_id < 0 || comp_id >= DDP_COMPONENT_DRM_ID_MAX)
+	if (comp_id >= DDP_COMPONENT_DRM_ID_MAX)
 		return -EINVAL;
 
 	type = mtk_ddp_matches[comp_id].type;
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw

Hi, Shawn:

Quoted 4 lines · Shawn Sung

From: Hsiao Chien Sung <[email protected]>

Fix a Coverity error that less-than-zero comparison of an unsigned value is never true.

Quoted 20 lines
Fixes 0d9eee9118b7 ("drm/mediatek: Add drm ovl_adaptor sub driver for MT8195")
---
 drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_ddp_comp.c +1 -1
index 17b036411292..a66e46d0b45e 100644
@@ -593,7 +593,7 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	int ret;
 #endif
 
-	if (comp_id < 0 || comp_id >= DDP_COMPONENT_DRM_ID_MAX)
+	if (comp_id >= DDP_COMPONENT_DRM_ID_MAX)
 		return -EINVAL;
 
 	type = mtk_ddp_matches[comp_id].type;