driver: pmc_atom: free pmc->regmap in pmc_setup_dev
PATCH 1/1 driver: pmc_atom: free pmc->regmap in pmc_setup_dev
Smatch reports:
drivers/platform/x86/pmc_atom.c:496pmc_setup_dev() warn: 'pmc->regmap' not released on lines: 496.
Fix this by deallocating pm->regmap.
--- drivers/platform/x86/pmc_atom.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/pmc_atom.c +1 -0
@@ -492,6 +492,7 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)dev_warn (&pdev->dev,"platform clocks register failed: %d\n" , ret); +iounmap (pmc->regmap); pmc->init = true;return ret; }
Signature · 1 line
2.25.1
Quoted 18 lines · Dongliang Mu
Smatch reports:
drivers/platform/x86/pmc_atom.c:496pmc_setup_dev()warn: 'pmc->regmap' not released on lines: 496.Fix this by deallocating
pm->regmap.CC Dan Carpenter <[email protected]>Signed-off-by Dongliang Mu <[email protected]>--- drivers/platform/x86/pmc_atom.c | 1 + 1 file changed, 1 insertion(+)drivers/platform/x86/pmc_atom.c +0
-0
drivers/platform/x86/pmc_atom.c static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent) · line 495
Quoted 4 lines
drivers/platform/x86/pmc_atom.c +1
-0@@ -492,6 +492,7 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)dev_warn (&pdev->dev,"platform clocks register failed: %d\n" , ret); +iounmap (pmc->regmap);
This releases it on the success path so it will break the driver.
regards,
dan carpenter
Quoted 5 lines
drivers/platform/x86/pmc_atom.c +0
-0pmc->init = true;return ret; }Signature · 1 line
2.25.1
Quoted 23 lines · Dan Carpenter
Quoted 21 lines · Dongliang Mu
Smatch reports:
drivers/platform/x86/pmc_atom.c:496pmc_setup_dev()warn: 'pmc->regmap' not released on lines: 496.Fix this by deallocating
pm->regmap.CC Dan Carpenter <[email protected]>Signed-off-by Dongliang Mu <[email protected]>--- drivers/platform/x86/pmc_atom.c | 1 + 1 file changed, 1 insertion(+)drivers/platform/x86/pmc_atom.c +0
-0@@ -492,6 +492,7 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)dev_warn (&pdev->dev,"platform clocks register failed: %d\n" , ret);
Quoted 3 lines
drivers/platform/x86/pmc_atom.c static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent) · line 495
Quoted 1 line
drivers/platform/x86/pmc_atom.c +1
-0+iounmap (pmc->regmap);This releases it on the success path so it will break the driver.
Yes. I should only deallocate it in the failure handling of pm_setup_clks. Will modify it in the v2 version.
Quoted 9 lines
regards,
dan carpenterQuoted 5 lines
drivers/platform/x86/pmc_atom.c +0
-1pmc->init = true;return ret; } --2.25.1