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

Commit 77254950 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

PM: Make dev_pm_get_subsys_data() always return 0 on success



Commits 1d5fcfec (PM / Domains: Add device domain data reference
counter) and 62d44902 (PM / Domains: Allow device callbacks to be
added at any time) added checks for the return value of
dev_pm_get_subsys_data(), but those checks were incorrect, because
that function returned 1 on success in some cases.

Since all of the existing users of dev_pm_get_subsys_data() don't use
the positive value returned by it on success, change its definition
so that it always returns 0 when successful.

Reported-by: default avatarHeiko Stübner <heiko@sntech.de>
Reported-by: default avatarTushar Behera <tushar.behera@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent d06a8a4f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -169,8 +169,7 @@ void pm_clk_init(struct device *dev)
 */
int pm_clk_create(struct device *dev)
{
	int ret = dev_pm_get_subsys_data(dev);
	return ret < 0 ? ret : 0;
	return dev_pm_get_subsys_data(dev);
}

/**
+1 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
int dev_pm_get_subsys_data(struct device *dev)
{
	struct pm_subsys_data *psd;
	int ret = 0;

	psd = kzalloc(sizeof(*psd), GFP_KERNEL);
	if (!psd)
@@ -40,7 +39,6 @@ int dev_pm_get_subsys_data(struct device *dev)
		dev->power.subsys_data = psd;
		pm_clk_init(dev);
		psd = NULL;
		ret = 1;
	}

	spin_unlock_irq(&dev->power.lock);
@@ -48,7 +46,7 @@ int dev_pm_get_subsys_data(struct device *dev)
	/* kfree() verifies that its argument is nonzero. */
	kfree(psd);

	return ret;
	return 0;
}
EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data);