[bug report] pds_core: add devcmd device interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Shannon Nelson,

The patch 523847df1b37: "pds_core: add devcmd device interfaces" from
Apr 19, 2023, leads to the following Smatch static checker warning:

	drivers/net/ethernet/amd/pds_core/main.c:290 pdsc_init_pf()
	error: double unlocked '&pdsc->config_lock' (orig line 253)

drivers/net/ethernet/amd/pds_core/main.c
    212 static int pdsc_init_pf(struct pdsc *pdsc)
    213 {
    214         struct devlink_health_reporter *hr;
    215         char wq_name[PDSC_WQ_NAME_LEN];
    216         struct devlink *dl;
    217         int err;
    218 
    219         pcie_print_link_status(pdsc->pdev);
    220 
    221         err = pci_request_regions(pdsc->pdev, PDS_CORE_DRV_NAME);
    222         if (err) {
    223                 dev_err(pdsc->dev, "Cannot request PCI regions: %pe\n",
    224                         ERR_PTR(err));
    225                 return err;
    226         }
    227 
    228         err = pdsc_map_bars(pdsc);
    229         if (err)
    230                 goto err_out_release_regions;
    231 
    232         /* General workqueue and timer, but don't start timer yet */
    233         snprintf(wq_name, sizeof(wq_name), "%s.%d", PDS_CORE_DRV_NAME, pdsc->uid);
    234         pdsc->wq = create_singlethread_workqueue(wq_name);
    235         INIT_WORK(&pdsc->health_work, pdsc_health_thread);
    236         timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);
    237         pdsc->wdtimer_period = PDSC_WATCHDOG_SECS * HZ;
    238 
    239         mutex_init(&pdsc->devcmd_lock);
    240         mutex_init(&pdsc->config_lock);
    241         spin_lock_init(&pdsc->adminq_lock);
    242 
    243         mutex_lock(&pdsc->config_lock);
    244         set_bit(PDSC_S_FW_DEAD, &pdsc->state);
    245 
    246         err = pdsc_setup(pdsc, PDSC_SETUP_INIT);
    247         if (err)
    248                 goto err_out_unmap_bars;
    249         err = pdsc_start(pdsc);
    250         if (err)
    251                 goto err_out_teardown;
    252 
    253         mutex_unlock(&pdsc->config_lock);

unlock

    254 
    255         dl = priv_to_devlink(pdsc);
    256         devl_lock(dl);
    257         err = devl_params_register(dl, pdsc_dl_params,
    258                                    ARRAY_SIZE(pdsc_dl_params));
    259         if (err) {
    260                 dev_warn(pdsc->dev, "Failed to register devlink params: %pe\n",
    261                          ERR_PTR(err));
    262                 goto err_out_unlock_dl;

goto

    263         }
    264 
    265         hr = devl_health_reporter_create(dl, &pdsc_fw_reporter_ops, 0, pdsc);
    266         if (IS_ERR(hr)) {
    267                 dev_warn(pdsc->dev, "Failed to create fw reporter: %pe\n", hr);
    268                 err = PTR_ERR(hr);
    269                 goto err_out_unreg_params;
    270         }
    271         pdsc->fw_reporter = hr;
    272 
    273         devl_register(dl);
    274         devl_unlock(dl);
    275 
    276         /* Lastly, start the health check timer */
    277         mod_timer(&pdsc->wdtimer, round_jiffies(jiffies + pdsc->wdtimer_period));
    278 
    279         return 0;
    280 
    281 err_out_unreg_params:
    282         devl_params_unregister(dl, pdsc_dl_params,
    283                                ARRAY_SIZE(pdsc_dl_params));
    284 err_out_unlock_dl:
    285         devl_unlock(dl);
    286         pdsc_stop(pdsc);
    287 err_out_teardown:
    288         pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
    289 err_out_unmap_bars:
--> 290         mutex_unlock(&pdsc->config_lock);

double unlock.

    291         del_timer_sync(&pdsc->wdtimer);
    292         if (pdsc->wq)
    293                 destroy_workqueue(pdsc->wq);
    294         mutex_destroy(&pdsc->config_lock);
    295         mutex_destroy(&pdsc->devcmd_lock);
    296         pci_free_irq_vectors(pdsc->pdev);
    297         pdsc_unmap_bars(pdsc);
    298 err_out_release_regions:
    299         pci_release_regions(pdsc->pdev);
    300 
    301         return err;
    302 }

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux