gpib: Fix error code in ni_usb_write_registers()

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: 4e127de14f ("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>
This commit is contained in:
Dan Carpenter 2025-11-28 10:17:57 +03:00 committed by Greg Kroah-Hartman
parent 96118565d2
commit 484e622522
1 changed files with 1 additions and 1 deletions

View 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);