]> www.infradead.org Git - users/willy/xarray.git/commitdiff
i2c: virtio: Replace dev_err() with dev_err_probe() in probe function
authorEnrico Zanda <e.zanda1@gmail.com>
Tue, 15 Apr 2025 18:34:44 +0000 (20:34 +0200)
committerAndi Shyti <andi@smida.it>
Mon, 19 May 2025 20:23:55 +0000 (22:23 +0200)
This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
Link: https://lore.kernel.org/r/20250415183447.396277-8-e.zanda1@gmail.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-virtio.c

index 2a351f961b89932f770db00d22fc78ee35c2f655..9b05ff53d3d7216980d36e4fd3ea6f2142563e3b 100644 (file)
@@ -192,10 +192,9 @@ static int virtio_i2c_probe(struct virtio_device *vdev)
        struct virtio_i2c *vi;
        int ret;
 
-       if (!virtio_has_feature(vdev, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST)) {
-               dev_err(&vdev->dev, "Zero-length request feature is mandatory\n");
-               return -EINVAL;
-       }
+       if (!virtio_has_feature(vdev, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST))
+               return dev_err_probe(&vdev->dev, -EINVAL,
+                                    "Zero-length request feature is mandatory\n");
 
        vi = devm_kzalloc(&vdev->dev, sizeof(*vi), GFP_KERNEL);
        if (!vi)