On Thu, Oct 24, 2024 at 02:53:22PM +0800, Wei Fang wrote: > @@ -62,6 +65,12 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, > goto err_pci_mem_reg; > } > > + if (pdev->vendor == PCI_VENDOR_ID_FREESCALE && > + pdev->device == ENETC_MDIO_DEV_ID) { > + static_branch_inc(&enetc_has_err050089); > + dev_info(&pdev->dev, "Enabled ERR050089 workaround\n"); > + } > + > err = of_mdiobus_register(bus, dev->of_node); > if (err) > goto err_mdiobus_reg; If of_mdiobus_register() fails, we should disable the static key. Perhaps the snippets to enable and disable the static key should be in helper functions to more easily insert the error teardown logic.