]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: Avoid coverity warning when checking width
authorSimon Glass <sjg@chromium.org>
Fri, 14 May 2021 01:39:28 +0000 (19:39 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 15 Jul 2021 22:42:05 +0000 (18:42 -0400)
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@chromium.org>
Reported-by: Coverity (CID: 331154)
drivers/pinctrl/pinctrl-single.c

index 7af6c5f0b0371cdbd0b580f6ad46a0fe91db19d6..cf9ad3670f6961a8d567f1f66994689e77c96f3d 100644 (file)
@@ -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) {