From: Rajvi Jingar Date: Tue, 19 Dec 2023 04:22:09 +0000 (-0800) Subject: platform/x86/intel/pmc: Fix in mtl_punit_pmt_init() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1f5e56c9f6cc92c45d27adfe78fb54c716fed2e2;p=linux.git platform/x86/intel/pmc: Fix in mtl_punit_pmt_init() pci_get_domain_bus_and_slot() increases the reference count on the pci device that is used to register the endpoint. In case of failure in registration, decrease reference count using pci_dev_put(pcidev) before returning. Fixes: 6e7964855381 ("platform/x86/intel/pmc: Show Die C6 counter on Meteor Lake") Signed-off-by: Rajvi Jingar Signed-off-by: David E. Box Link: https://lore.kernel.org/r/20231219042216.2592029-1-rajvi.jingar@linux.intel.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede --- diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c index 38c2f946ec231..fb59dffccf281 100644 --- a/drivers/platform/x86/intel/pmc/mtl.c +++ b/drivers/platform/x86/intel/pmc/mtl.c @@ -985,6 +985,7 @@ static void mtl_punit_pmt_init(struct pmc_dev *pmcdev) } ep = pmt_telem_find_and_register_endpoint(pcidev, MTL_PMT_DMU_GUID, 0); + pci_dev_put(pcidev); if (IS_ERR(ep)) { dev_err(&pmcdev->pdev->dev, "pmc_core: couldn't get DMU telem endpoint, %ld\n", @@ -992,7 +993,6 @@ static void mtl_punit_pmt_init(struct pmc_dev *pmcdev) return; } - pci_dev_put(pcidev); pmcdev->punit_ep = ep; pmcdev->has_die_c6 = true;