diff options
author | Vincent Stehlé <vincent.stehle@laposte.net> | 2021-02-14 19:39:04 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-02-24 16:51:48 -0500 |
commit | 25d34b936cef12cf8b481b64fe9d02c08df12908 (patch) | |
tree | 8c9a5d15891b3758212480bd9c0a655d91668b97 | |
parent | e420a38fa69b2d528466a4b6d40deb1fb58ea352 (diff) | |
download | u-boot-25d34b936cef12cf8b481b64fe9d02c08df12908.zip u-boot-25d34b936cef12cf8b481b64fe9d02c08df12908.tar.gz u-boot-25d34b936cef12cf8b481b64fe9d02c08df12908.tar.bz2 |
virtio: fix off by one device id comparison
VIRTIO_ID_MAX_NUM is the largest device ID plus 1. Therefore a device id
cannot be greater or equal to VIRTIO_ID_MAX_NUM. Fix the comparison
accordingly.
Fixes: 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport devices")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
-rw-r--r-- | drivers/virtio/virtio-uclass.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index cf2cfae..0379536 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -227,7 +227,7 @@ static int virtio_uclass_post_probe(struct udevice *udev) struct udevice *vdev; int ret; - if (uc_priv->device > VIRTIO_ID_MAX_NUM) { + if (uc_priv->device >= VIRTIO_ID_MAX_NUM) { debug("(%s): virtio device ID %d exceeds maximum num\n", udev->name, uc_priv->device); return 0; |