[PATCH v2] staging: gpib: Add missing mutex unlock on early return in

Dave Penkler posted 1 patch 11 months, 2 weeks ago
There is a newer version of this series
drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 1 +
1 file changed, 1 insertion(+)
[PATCH v2] staging: gpib: Add missing mutex unlock on early return in
Posted by Dave Penkler 11 months, 2 weeks ago
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
Re: [PATCH v2] staging: gpib: Add missing mutex unlock on early return in
Posted by Greg KH 11 months, 1 week ago
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