[<prev] [next>] [day] [month] [year] [list]
Message-ID: <affedc44-c822-47a5-8db4-7bfad72dc408@stanley.mountain>
Date: Mon, 6 Jan 2025 10:09:35 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Dave Penkler <dpenkler@...il.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: drivers/staging/gpib/agilent_82357a/agilent_82357a.c:1381
agilent_82357a_attach() warn: inconsistent returns 'global
&agilent_82357a_hotplug_lock'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8faabc041a001140564f718dabe37753e88b37fa
commit: 165e8cc3cfec9ef51f3376b0d49b115294f34f3b staging: gpib: Add KBUILD files for GPIB drivers
config: i386-randconfig-141-20241220 (https://download.01.org/0day-ci/archive/20241221/202412210143.WJhYzXfD-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202412210143.WJhYzXfD-lkp@intel.com/
smatch warnings:
drivers/staging/gpib/agilent_82357a/agilent_82357a.c:1381 agilent_82357a_attach() warn: inconsistent returns 'global &agilent_82357a_hotplug_lock'.
vim +1381 drivers/staging/gpib/agilent_82357a/agilent_82357a.c
4c41fe886a56c5b Dave Penkler 2024-09-18 1306 static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t *config)
4c41fe886a56c5b Dave Penkler 2024-09-18 1307 {
4c41fe886a56c5b Dave Penkler 2024-09-18 1308 int retval;
4c41fe886a56c5b Dave Penkler 2024-09-18 1309 int i;
4c41fe886a56c5b Dave Penkler 2024-09-18 1310 unsigned int product_id;
4c41fe886a56c5b Dave Penkler 2024-09-18 1311 struct agilent_82357a_priv *a_priv;
4c41fe886a56c5b Dave Penkler 2024-09-18 1312 struct usb_device *usb_dev;
4c41fe886a56c5b Dave Penkler 2024-09-18 1313
4c41fe886a56c5b Dave Penkler 2024-09-18 1314 if (mutex_lock_interruptible(&agilent_82357a_hotplug_lock))
4c41fe886a56c5b Dave Penkler 2024-09-18 1315 return -ERESTARTSYS;
4c41fe886a56c5b Dave Penkler 2024-09-18 1316
4c41fe886a56c5b Dave Penkler 2024-09-18 1317 retval = agilent_82357a_allocate_private(board);
4c41fe886a56c5b Dave Penkler 2024-09-18 1318 if (retval < 0) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1319 mutex_unlock(&agilent_82357a_hotplug_lock);
4c41fe886a56c5b Dave Penkler 2024-09-18 1320 return retval;
4c41fe886a56c5b Dave Penkler 2024-09-18 1321 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1322 a_priv = board->private_data;
4c41fe886a56c5b Dave Penkler 2024-09-18 1323 for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1324 if (agilent_82357a_driver_interfaces[i] &&
4c41fe886a56c5b Dave Penkler 2024-09-18 1325 !usb_get_intfdata(agilent_82357a_driver_interfaces[i]) &&
4c41fe886a56c5b Dave Penkler 2024-09-18 1326 agilent_82357a_device_match(agilent_82357a_driver_interfaces[i], config)) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1327 a_priv->bus_interface = agilent_82357a_driver_interfaces[i];
4c41fe886a56c5b Dave Penkler 2024-09-18 1328 usb_set_intfdata(agilent_82357a_driver_interfaces[i], board);
4c41fe886a56c5b Dave Penkler 2024-09-18 1329 usb_dev = interface_to_usbdev(a_priv->bus_interface);
4c41fe886a56c5b Dave Penkler 2024-09-18 1330 dev_info(&usb_dev->dev,
4c41fe886a56c5b Dave Penkler 2024-09-18 1331 "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n",
4c41fe886a56c5b Dave Penkler 2024-09-18 1332 usb_dev->bus->busnum, usb_dev->devnum, board->minor, i);
4c41fe886a56c5b Dave Penkler 2024-09-18 1333 break;
4c41fe886a56c5b Dave Penkler 2024-09-18 1334 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1335 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1336 if (i == MAX_NUM_82357A_INTERFACES) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1337 mutex_unlock(&agilent_82357a_hotplug_lock);
4c41fe886a56c5b Dave Penkler 2024-09-18 1338 pr_err("No Agilent 82357 gpib adapters found, have you loaded its firmware?\n");
4c41fe886a56c5b Dave Penkler 2024-09-18 1339 return -ENODEV;
4c41fe886a56c5b Dave Penkler 2024-09-18 1340 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1341 product_id = le16_to_cpu(interface_to_usbdev(a_priv->bus_interface)->descriptor.idProduct);
4c41fe886a56c5b Dave Penkler 2024-09-18 1342 switch (product_id) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1343 case USB_DEVICE_ID_AGILENT_82357A:
4c41fe886a56c5b Dave Penkler 2024-09-18 1344 a_priv->bulk_out_endpoint = AGILENT_82357A_BULK_OUT_ENDPOINT;
4c41fe886a56c5b Dave Penkler 2024-09-18 1345 a_priv->interrupt_in_endpoint = AGILENT_82357A_INTERRUPT_IN_ENDPOINT;
4c41fe886a56c5b Dave Penkler 2024-09-18 1346 break;
4c41fe886a56c5b Dave Penkler 2024-09-18 1347 case USB_DEVICE_ID_AGILENT_82357B:
4c41fe886a56c5b Dave Penkler 2024-09-18 1348 a_priv->bulk_out_endpoint = AGILENT_82357B_BULK_OUT_ENDPOINT;
4c41fe886a56c5b Dave Penkler 2024-09-18 1349 a_priv->interrupt_in_endpoint = AGILENT_82357B_INTERRUPT_IN_ENDPOINT;
4c41fe886a56c5b Dave Penkler 2024-09-18 1350 break;
4c41fe886a56c5b Dave Penkler 2024-09-18 1351 default:
4c41fe886a56c5b Dave Penkler 2024-09-18 1352 pr_err("bug, unhandled product_id in switch?\n");
mutex_unlock(&agilent_82357a_hotplug_lock); before returning.
4c41fe886a56c5b Dave Penkler 2024-09-18 1353 return -EIO;
4c41fe886a56c5b Dave Penkler 2024-09-18 1354 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1355 #ifdef RESET_USB_CONFIG
4c41fe886a56c5b Dave Penkler 2024-09-18 1356 retval = agilent_82357a_reset_usb_configuration(board);
4c41fe886a56c5b Dave Penkler 2024-09-18 1357 if (retval < 0) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1358 mutex_unlock(&agilent_82357a_hotplug_lock);
4c41fe886a56c5b Dave Penkler 2024-09-18 1359 return retval;
4c41fe886a56c5b Dave Penkler 2024-09-18 1360 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1361 #endif
4c41fe886a56c5b Dave Penkler 2024-09-18 1362 retval = agilent_82357a_setup_urbs(board);
4c41fe886a56c5b Dave Penkler 2024-09-18 1363 if (retval < 0) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1364 mutex_unlock(&agilent_82357a_hotplug_lock);
4c41fe886a56c5b Dave Penkler 2024-09-18 1365 return retval;
4c41fe886a56c5b Dave Penkler 2024-09-18 1366 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1367
4c41fe886a56c5b Dave Penkler 2024-09-18 1368 timer_setup(&a_priv->bulk_timer, agilent_82357a_timeout_handler, 0);
4c41fe886a56c5b Dave Penkler 2024-09-18 1369
4c41fe886a56c5b Dave Penkler 2024-09-18 1370 board->t1_nano_sec = 800;
4c41fe886a56c5b Dave Penkler 2024-09-18 1371
4c41fe886a56c5b Dave Penkler 2024-09-18 1372 retval = agilent_82357a_init(board);
4c41fe886a56c5b Dave Penkler 2024-09-18 1373
4c41fe886a56c5b Dave Penkler 2024-09-18 1374 if (retval < 0) {
4c41fe886a56c5b Dave Penkler 2024-09-18 1375 mutex_unlock(&agilent_82357a_hotplug_lock);
4c41fe886a56c5b Dave Penkler 2024-09-18 1376 return retval;
4c41fe886a56c5b Dave Penkler 2024-09-18 1377 }
4c41fe886a56c5b Dave Penkler 2024-09-18 1378
4c41fe886a56c5b Dave Penkler 2024-09-18 1379 pr_info("%s: attached\n", __func__);
4c41fe886a56c5b Dave Penkler 2024-09-18 1380 mutex_unlock(&agilent_82357a_hotplug_lock);
4c41fe886a56c5b Dave Penkler 2024-09-18 @1381 return retval;
4c41fe886a56c5b Dave Penkler 2024-09-18 1382 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists