Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4ebb780 authored by Jiri Slaby's avatar Jiri Slaby Committed by Richard Purdie
Browse files

video: backlight/progear, fix pci device refcounting



Stanse found an ommitted pci_dev_puts on error path in progearbl_probe.
pmu_dev and sb_dev are gotten, but never put when
backlight_device_register fails.

So unify fail paths and put the devs when the failure occurs.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent c3cf2e44
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -63,6 +63,7 @@ static int progearbl_probe(struct platform_device *pdev)
{
{
	u8 temp;
	u8 temp;
	struct backlight_device *progear_backlight_device;
	struct backlight_device *progear_backlight_device;
	int ret;


	pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL);
	pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL);
	if (!pmu_dev) {
	if (!pmu_dev) {
@@ -73,8 +74,8 @@ static int progearbl_probe(struct platform_device *pdev)
	sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
	sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
	if (!sb_dev) {
	if (!sb_dev) {
		printk("ALI 1533 SB not found.\n");
		printk("ALI 1533 SB not found.\n");
		pci_dev_put(pmu_dev);
		ret = -ENODEV;
		return -ENODEV;
		goto put_pmu;
	}
	}


	/*     Set SB_MPS1 to enable brightness control. */
	/*     Set SB_MPS1 to enable brightness control. */
@@ -84,8 +85,10 @@ static int progearbl_probe(struct platform_device *pdev)
	progear_backlight_device = backlight_device_register("progear-bl",
	progear_backlight_device = backlight_device_register("progear-bl",
							     &pdev->dev, NULL,
							     &pdev->dev, NULL,
							     &progearbl_ops);
							     &progearbl_ops);
	if (IS_ERR(progear_backlight_device))
	if (IS_ERR(progear_backlight_device)) {
		return PTR_ERR(progear_backlight_device);
		ret = PTR_ERR(progear_backlight_device);
		goto put_sb;
	}


	platform_set_drvdata(pdev, progear_backlight_device);
	platform_set_drvdata(pdev, progear_backlight_device);


@@ -95,6 +98,11 @@ static int progearbl_probe(struct platform_device *pdev)
	progearbl_set_intensity(progear_backlight_device);
	progearbl_set_intensity(progear_backlight_device);


	return 0;
	return 0;
put_sb:
	pci_dev_put(sb_dev);
put_pmu:
	pci_dev_put(pmu_dev);
	return ret;
}
}


static int progearbl_remove(struct platform_device *pdev)
static int progearbl_remove(struct platform_device *pdev)