* [PATCH v2] staging: gpib: Add missing mutex unlock on early return in
@ 2025-01-08 17:41 Dave Penkler
2025-01-10 15:01 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Dave Penkler @ 2025-01-08 17:41 UTC (permalink / raw)
To: gregkh, linux-staging, linux-kernel
Cc: Dave Penkler, kernel test robot, Dan Carpenter
When no matching product id was found in the attach function the driver
returned without unlocking the agilent_82357a_hotplug_lock mutex.
Add the unlock call.
This was detected by smatch:
smatch warnings:
drivers/staging/gpib/agilent_82357a/agilent_82357a.c:1381 agilent_82357a_attach() warn: inconsistent returns 'global &agilent_82357a_hotplug_lock'.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202412210143.WJhYzXfD-lkp@intel.com/
Fixes: 4c41fe886a56 ("staging: gpib: Add Agilent/Keysight 82357x USB GPIB driver")
Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
v1 -> v2 Add subsystem prefix in subject
drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
index b21eadabc466..c22c6bb30776 100644
--- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
+++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
@@ -1365,6 +1365,7 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t
break;
default:
dev_err(&usb_dev->dev, "bug, unhandled product_id in switch?\n");
+ mutex_unlock(&agilent_82357a_hotplug_lock);
return -EIO;
}
#ifdef RESET_USB_CONFIG
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] staging: gpib: Add missing mutex unlock on early return in
@ 2025-01-08 17:42 Dave Penkler
0 siblings, 0 replies; 3+ messages in thread
From: Dave Penkler @ 2025-01-08 17:42 UTC (permalink / raw)
To: gregkh, linux-staging, linux-kernel
Cc: Dave Penkler, kernel test robot, Dan Carpenter
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>
---
drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
index 2c0a0d7e36c6..d0656dc520f5 100644
--- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
+++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c
@@ -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);
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] staging: gpib: Add missing mutex unlock on early return in
2025-01-08 17:41 [PATCH v2] staging: gpib: Add missing mutex unlock on early return in Dave Penkler
@ 2025-01-10 15:01 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2025-01-10 15:01 UTC (permalink / raw)
To: Dave Penkler
Cc: linux-staging, linux-kernel, kernel test robot, Dan Carpenter
On Wed, Jan 08, 2025 at 06:41:58PM +0100, Dave Penkler wrote:
> When no matching product id was found in the attach function the driver
> returned without unlocking the agilent_82357a_hotplug_lock mutex.
>
> Add the unlock call.
>
> This was detected by smatch:
> smatch warnings:
> drivers/staging/gpib/agilent_82357a/agilent_82357a.c:1381 agilent_82357a_attach() warn: inconsistent returns 'global &agilent_82357a_hotplug_lock'.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202412210143.WJhYzXfD-lkp@intel.com/
> Fixes: 4c41fe886a56 ("staging: gpib: Add Agilent/Keysight 82357x USB GPIB driver")
> Signed-off-by: Dave Penkler <dpenkler@gmail.com>
> ---
> v1 -> v2 Add subsystem prefix in subject
You sent 2 patches with identical subject lines, yet they do different
things. That's not good, can you fix them both up and resend?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-10 15:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 17:41 [PATCH v2] staging: gpib: Add missing mutex unlock on early return in Dave Penkler
2025-01-10 15:01 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2025-01-08 17:42 Dave Penkler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox