[PATCH v2 12/16] pinctrl: Avoid coverity warning when checking width

Simon Glass sjg at chromium.org
Fri May 14 03:39:28 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.

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

Changes in v2:
- Add a standard comment instead of a Coverity annotation

 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..d95722c5104 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
 
+	/* looks like a possible divide by 0, but data->width avoids this */
 	priv->npins = size / (pdata->width / BITS_PER_BYTE);
 	if (pdata->bits_per_mux) {
 		if (!pdata->mask) {
-- 
2.31.1.751.gd2f1c929bd-goog



More information about the U-Boot mailing list