]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpib: Fix error code in ni_usb_write_registers()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 28 Nov 2025 07:17:57 +0000 (10:17 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2026 15:31:39 +0000 (16:31 +0100)
If ni_usb_receive_bulk_msg() succeeds but without reading 16 bytes, then
the error code needs to be set.  The current code returns success.

Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aSlMpbE4IrQuBGFS@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpib/ni_usb/ni_usb_gpib.c

index 1f8412de9fa329556bafb2e9f20ddcc09dbc4102..fdcaa6c00bfeac4547bfce41300e974ae728ce16 100644 (file)
@@ -566,7 +566,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *ni_priv,
                        retval, bytes_read);
                ni_usb_dump_raw_block(in_data, bytes_read);
                kfree(in_data);
-               return retval;
+               return retval ?: -EINVAL;
        }
 
        mutex_unlock(&ni_priv->addressed_transfer_lock);