pci_get_device() increments the reference count on the PCI device.
Add missing pci_dev_put() in error paths to fix refcount leak.

Found via static analysis and code review.

Fixes: 1b082ccf5901 ("gma500: Add Oaktrail support")
Cc: [email protected]
Signed-off-by: Miaoqian Lin <[email protected]>
---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c 
b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 20d027d552c7..2be12acc93d2 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -712,10 +712,10 @@ void oaktrail_hdmi_setup(struct drm_device *dev)
        dev_info(dev->dev, "HDMI hardware present.\n");
 
        return;
-
 free:
        kfree(hdmi_dev);
 out:
+       pci_dev_put(pdev);
        return;
 }
 
-- 
2.25.1

Reply via email to