Skip to contentSkip to conversation

gpib: Fix error code in ni_usb_write_registers()

PATCH New Dan Carpenter 1 participant 1 message Nov 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver")
---
 drivers/gpib/ni_usb/ni_usb_gpib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpib/ni_usb/ni_usb_gpib.c +1 -1
index 1f8412de9fa3..fdcaa6c00bfe 100644
@@ -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);
Signature · 1 line
2.51.0