]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
virtio: fix return value check master
authorChristian Pötzsch <christian.poetzsch@kernkonzept.com>
Tue, 12 May 2026 08:39:49 +0000 (10:39 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 12 May 2026 18:38:49 +0000 (12:38 -0600)
The virtio_blk_do_single_req function returns ulong, which normally is
the processed size, but in an error case can be the actual error. Use
the special IS_ERR_VALUE macro to test for error.

Addresses-Coverity-ID: CID 645833 (DEADCODE) & CID 645834 (NO_EFFECT)
Signed-off-by: Christian Pötzsch <christian.poetzsch@kernkonzept.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/virtio/virtio_blk.c

index 45fb596a3308f2f5f1632f1a8235a085ca106481..7b1d891cdcbb5d5795ee64f0094ad4c64bb12c52 100644 (file)
@@ -13,6 +13,7 @@
 #include <virtio.h>
 #include <virtio_ring.h>
 #include <linux/log2.h>
+#include <linux/err.h>
 #include "virtio_blk.h"
 #include <malloc.h>
 
@@ -181,7 +182,7 @@ static ulong virtio_blk_do_req(struct udevice *dev, u64 sector,
 
                ret = virtio_blk_do_single_req(dev, sector + i, blk_per_sg,
                                               buffer + i * 512, type);
-               if (ret < 0)
+               if (IS_ERR_VALUE(ret))
                        return ret;
                i += blk_per_sg;
        }