* [PATCH v1 1/1] PM: Avoid false-positive warnings in dev_pm_domain_set()
@ 2016-02-01 14:12 Andy Shevchenko
2016-02-01 14:17 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2016-02-01 14:12 UTC (permalink / raw)
To: Rafael J. Wysocki, linux-pm, linux-kernel
Cc: Rafael J. Wysocki, Andy Shevchenko
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
There is a WARN_ON() in dev_pm_domain_set() that triggers on attempts
to set the pm_domain pointer for devices with a driver bound.
However, that WARN_ON() triggers on attempts to clear the pointer
too and the test it uses is based on checking the device's
p->knode_driver pointer which still is set when the device bus
type's/driver's ->remove callback has been executed. This
leads to false-positive warnings when bus type code calls
dev_pm_domain_set() to clear the pm_domain pointer after
invoking the driver's ->remove() callback.
To avoid those false-positives, make dev_pm_domain_set() check
if the pointer passed to it is NULL and skip the warning in
that case.
Fixes: 989561de9b51 (PM / Domains: add setter for dev.pm_domain)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/power/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index 93ed14c..f6a9ad5 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -146,7 +146,7 @@ void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd)
if (dev->pm_domain == pd)
return;
- WARN(device_is_bound(dev),
+ WARN(pd && device_is_bound(dev),
"PM domains can only be changed for unbound devices\n");
dev->pm_domain = pd;
device_pm_check_callbacks(dev);
--
2.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] PM: Avoid false-positive warnings in dev_pm_domain_set()
2016-02-01 14:12 [PATCH v1 1/1] PM: Avoid false-positive warnings in dev_pm_domain_set() Andy Shevchenko
@ 2016-02-01 14:17 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2016-02-01 14:17 UTC (permalink / raw)
To: Rafael J. Wysocki, linux-pm, linux-kernel; +Cc: Rafael J. Wysocki
On Mon, 2016-02-01 at 16:12 +0200, Andy Shevchenko wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> There is a WARN_ON() in dev_pm_domain_set() that triggers on attempts
> to set the pm_domain pointer for devices with a driver bound.
>
> However, that WARN_ON() triggers on attempts to clear the pointer
> too and the test it uses is based on checking the device's
> p->knode_driver pointer which still is set when the device bus
> type's/driver's ->remove callback has been executed. This
> leads to false-positive warnings when bus type code calls
> dev_pm_domain_set() to clear the pm_domain pointer after
> invoking the driver's ->remove() callback.
>
> To avoid those false-positives, make dev_pm_domain_set() check
> if the pointer passed to it is NULL and skip the warning in
> that case.
>
> Fixes: 989561de9b51 (PM / Domains: add setter for dev.pm_domain)
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Oops, it is a wrong one, should be previous.
Btw, this one has been tested and went fine!
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-01 14:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 14:12 [PATCH v1 1/1] PM: Avoid false-positive warnings in dev_pm_domain_set() Andy Shevchenko
2016-02-01 14:17 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.