]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86/intel/pmc: Use __free() in pmc_core_punit_pmt_init()
authorXi Pardee <xi.pardee@linux.intel.com>
Tue, 5 May 2026 04:33:32 +0000 (21:33 -0700)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 8 May 2026 18:38:42 +0000 (21:38 +0300)
Use scope-based cleanup in pmc_core_punit_pmt_init() instead of manually
freeing. This simplifies the code flow by removing the explicit put call,
making it less error-prone.

Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
Link: https://patch.msgid.link/20260505043342.2573556-2-xi.pardee@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/intel/pmc/core.c

index d91e1ab842d6524fcb6b87059efae437a0bbae76..c8a92d62352032a59cecede454355b6e7b05c8c2 100644 (file)
@@ -1325,16 +1325,15 @@ static struct telem_endpoint *pmc_core_register_endpoint(struct pci_dev *pcidev,
 void pmc_core_punit_pmt_init(struct pmc_dev *pmcdev, u32 *guids)
 {
        struct telem_endpoint *ep;
-       struct pci_dev *pcidev;
 
-       pcidev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(10, 0));
+       struct pci_dev *pcidev __free(pci_dev_put) = pci_get_domain_bus_and_slot(0, 0,
+                                                                                PCI_DEVFN(10, 0));
        if (!pcidev) {
                dev_err(&pmcdev->pdev->dev, "PUNIT PMT device not found.");
                return;
        }
 
        ep = pmc_core_register_endpoint(pcidev, guids);
-       pci_dev_put(pcidev);
        if (IS_ERR(ep)) {
                dev_err(&pmcdev->pdev->dev,
                        "pmc_core: couldn't get DMU telem endpoint %ld",