[PATCH 13/17] pinctrl: Avoid coverity warning when checking width

Simon Glass sjg at chromium.org
Sun May 9 00:00:17 CEST 2021


The width is set up in single_of_to_plat() and can only have three values,
all of which result in a non-zero divisor. Add a comment to help
coverity.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reported-by: Coverity (CID: 331154)
---

 drivers/pinctrl/pinctrl-single.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index ebb7602dde8..8100766d44b 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -471,6 +471,7 @@ static int single_probe(struct udevice *dev)
 		return -ENOMEM;
 	#endif
 
+	/* coverity[DIVIDE_BY_ZERO] */
 	priv->npins = size / (pdata->width / BITS_PER_BYTE);
 	if (pdata->bits_per_mux) {
 		if (!pdata->mask) {
-- 
2.31.1.607.g51e8a6a459-goog



More information about the U-Boot mailing list