* [PATCH 2/2] intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS [not found] <20161010111313.119658-1-arnd@arndb.de> @ 2016-10-10 11:12 ` Arnd Bergmann 2016-10-10 12:29 ` Greg Kroah-Hartman 0 siblings, 1 reply; 3+ messages in thread From: Arnd Bergmann @ 2016-10-10 11:12 UTC (permalink / raw) To: Darren Hart Cc: Greg Kroah-Hartman, Andy Shevchenko, Rajneesh Bhardwaj, Darren Hart, Nicolai Stange, Arnd Bergmann, Vishwanath Somayaji, platform-driver-x86, linux-kernel While looking at a patch that introduced a compile-time warning "‘pmc_core_dev_state_get’ defined but not used" (I sent a patch for debugfs to fix it), I noticed that the same patch caused it in intel_pmc_core also introduced a bogus run-time warning: "PMC Core: debugfs register failed". The problem is the IS_ERR_OR_NULL() check that as usual gets things wrong: when CONFIG_DEBUGFS_FS is disabled, debugfs_create_dir() fails with an error code, and we don't need to warn about it, unlike the case in which it returns NULL. This reverts the driver to the previous state of not warning about CONFIG_DEBUGFS_FS being disabled. I chose not to restore the driver to making a runtime error in debugfs fatal in pmc_core_probe(). Fixes: df2294fb6428 ("intel_pmc_core: Convert to DEFINE_DEBUGFS_ATTRIBUTE") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/platform/x86/intel_pmc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 520b58a04daa..e8b1b836ca2d 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -100,7 +100,7 @@ static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) struct dentry *dir, *file; dir = debugfs_create_dir("pmc_core", NULL); - if (IS_ERR_OR_NULL(dir)) + if (!dir) return -ENOMEM; pmcdev->dbgfs_dir = dir; -- 2.9.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS 2016-10-10 11:12 ` [PATCH 2/2] intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS Arnd Bergmann @ 2016-10-10 12:29 ` Greg Kroah-Hartman 2016-10-12 8:13 ` Darren Hart 0 siblings, 1 reply; 3+ messages in thread From: Greg Kroah-Hartman @ 2016-10-10 12:29 UTC (permalink / raw) To: Arnd Bergmann Cc: Darren Hart, Andy Shevchenko, Rajneesh Bhardwaj, Darren Hart, Nicolai Stange, Vishwanath Somayaji, platform-driver-x86, linux-kernel On Mon, Oct 10, 2016 at 01:12:58PM +0200, Arnd Bergmann wrote: > While looking at a patch that introduced a compile-time warning > "‘pmc_core_dev_state_get’ defined but not used" (I sent a patch > for debugfs to fix it), I noticed that the same patch caused > it in intel_pmc_core also introduced a bogus run-time warning: > "PMC Core: debugfs register failed". > > The problem is the IS_ERR_OR_NULL() check that as usual gets > things wrong: when CONFIG_DEBUGFS_FS is disabled, > debugfs_create_dir() fails with an error code, and we don't > need to warn about it, unlike the case in which it returns > NULL. > > This reverts the driver to the previous state of not warning > about CONFIG_DEBUGFS_FS being disabled. I chose not to > restore the driver to making a runtime error in debugfs > fatal in pmc_core_probe(). > > Fixes: df2294fb6428 ("intel_pmc_core: Convert to DEFINE_DEBUGFS_ATTRIBUTE") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/platform/x86/intel_pmc_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c > index 520b58a04daa..e8b1b836ca2d 100644 > --- a/drivers/platform/x86/intel_pmc_core.c > +++ b/drivers/platform/x86/intel_pmc_core.c > @@ -100,7 +100,7 @@ static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) > struct dentry *dir, *file; > > dir = debugfs_create_dir("pmc_core", NULL); > - if (IS_ERR_OR_NULL(dir)) > + if (!dir) > return -ENOMEM; Hah, no, you shouldn't ever care about any return value being "wrong" from debugfs, the code should just continue on as normal. And yes, you are correct, the IS_ERR_OR_NULL() is totally wrong. thanks, greg k-h ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS 2016-10-10 12:29 ` Greg Kroah-Hartman @ 2016-10-12 8:13 ` Darren Hart 0 siblings, 0 replies; 3+ messages in thread From: Darren Hart @ 2016-10-12 8:13 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Arnd Bergmann, Andy Shevchenko, Rajneesh Bhardwaj, Darren Hart, Nicolai Stange, Vishwanath Somayaji, platform-driver-x86, linux-kernel On Mon, Oct 10, 2016 at 02:29:17PM +0200, Greg Kroah-Hartman wrote: > On Mon, Oct 10, 2016 at 01:12:58PM +0200, Arnd Bergmann wrote: > > While looking at a patch that introduced a compile-time warning > > "‘pmc_core_dev_state_get’ defined but not used" (I sent a patch > > for debugfs to fix it), I noticed that the same patch caused > > it in intel_pmc_core also introduced a bogus run-time warning: > > "PMC Core: debugfs register failed". > > > > The problem is the IS_ERR_OR_NULL() check that as usual gets > > things wrong: when CONFIG_DEBUGFS_FS is disabled, > > debugfs_create_dir() fails with an error code, and we don't > > need to warn about it, unlike the case in which it returns > > NULL. > > > > This reverts the driver to the previous state of not warning > > about CONFIG_DEBUGFS_FS being disabled. I chose not to > > restore the driver to making a runtime error in debugfs > > fatal in pmc_core_probe(). > > > > Fixes: df2294fb6428 ("intel_pmc_core: Convert to DEFINE_DEBUGFS_ATTRIBUTE") > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > --- > > drivers/platform/x86/intel_pmc_core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c > > index 520b58a04daa..e8b1b836ca2d 100644 > > --- a/drivers/platform/x86/intel_pmc_core.c > > +++ b/drivers/platform/x86/intel_pmc_core.c > > @@ -100,7 +100,7 @@ static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) > > struct dentry *dir, *file; > > > > dir = debugfs_create_dir("pmc_core", NULL); > > - if (IS_ERR_OR_NULL(dir)) > > + if (!dir) > > return -ENOMEM; > > Hah, no, you shouldn't ever care about any return value being "wrong" > from debugfs, the code should just continue on as normal. > > And yes, you are correct, the IS_ERR_OR_NULL() is totally wrong. > > thanks, > > greg k-h > Thanks Arnd and Greg, appreciate the catch and the fix. Applied. -- Darren Hart Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-12 8:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20161010111313.119658-1-arnd@arndb.de>
2016-10-10 11:12 ` [PATCH 2/2] intel_pmc_core: avoid boot time warning for !CONFIG_DEBUGFS_FS Arnd Bergmann
2016-10-10 12:29 ` Greg Kroah-Hartman
2016-10-12 8:13 ` Darren Hart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox