mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 05:58:24 -04:00
staging: gpib: Add missing mutex unlock in ni usb driver
When the buffer allocation for return data in ni_usb_write() fails we were returning without unlocking the addressed_transfer_lock. Add the unlock call. This was detected by smatch: New smatch warnings: drivers/staging/gpib/ni_usb/ni_usb_gpib.c:837 ni_usb_write() warn: inconsistent returns '&ni_priv->addressed_transfer_lock'. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202412201550.9NCO57Ye-lkp@intel.com/ Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250111161548.27601-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
55eb3c3a63
commit
d43f18d947
@@ -783,8 +783,10 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *buffer, size_t length,
|
||||
}
|
||||
|
||||
in_data = kmalloc(in_data_length, GFP_KERNEL);
|
||||
if (!in_data)
|
||||
if (!in_data) {
|
||||
mutex_unlock(&ni_priv->addressed_transfer_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
retval = ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &usb_bytes_read,
|
||||
ni_usb_timeout_msecs(board->usec_timeout), 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user