[lvc-project] [PATCH] wifi: brcmfmac: avoid calling platform_driver_unregister() more than once

Dmitry Antipov dmantipov at yandex.ru
Mon Apr 14 12:56:56 MSK 2025


On 4/14/25 12:22 PM, Arend van Spriel wrote:

> When the platform_driver_probe() fails it means that brcmfmac_pdata will be NULL

Hm.

platform_driver_register()
  -> probe (which is brcmf_common_pd_probe())
     ...
     brcmfmac_pdata = dev_get_platdata(&pdev->dev);
     ...
  ...
  if (!bus_for_each_dev(&platform_bus_type, NULL, &drv->driver, is_bound_to_driver)) {
          retval = -ENODEV;
          platform_driver_unregister(drv); [1]
  }

If we hit platform_driver_unregister() at [1], 'brcmfmac_pdata' is not NULL and,
if something goes wrong in brcmf_core_init() next,  platform_driver_unregister()
may be called again.

Shouldn't 'brcmf_common_pd_remove()' reset 'brcmfmac_data' back to NULL?

Dmitry




More information about the lvc-project mailing list