Skip to contentSkip to conversation

drm: Don't return 0 for a value used as a denominator

PATCH New Damien Lespiau 1 participant 1 message Aug 8, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Don't return 0 for a value used as a denominator

Static analysis will be unhappy if a function can theoretically return 0 and we're trying to divide by that value.

Mark that case that cannot occur as a BUG() instead.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
index 352f5d6..b3adf14 100644
@@ -1772,7 +1772,7 @@ static int drm_dp_get_vc_payload_bw(int dp_link_bw, int dp_link_count)
 	case DP_LINK_BW_5_4:
 		return 10 * dp_link_count;
 	}
-	return 0;
+	BUG();
 }
 
 /**
Signature · 1 line
1.8.3.1