Message ID | 709e8015ccece63cdf0c2e0cd491fd5ca2984e8d.1496351574.git.priyalee.kushwaha@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On Fri, Jun 2, 2017 at 12:33 AM, <priyalee.kushwaha@intel.com> wrote: > This fix oops found while testing load/unload test of > intel_telemetry_debugfs module. Module_init uses register_pm_notifier > for PM callbacks, but unregister_pm_notifier was missing from > module_exit. > +#ifdef CONFIG_PM_SLEEP > + unregister_pm_notifier(&pm_notifier); > +#endif /* CONFIG_PM_SLEEP */ Neither here > +#ifdef CONFIG_PM_SLEEP > + unregister_pm_notifier(&pm_notifier); > +#endif /* CONFIG_PM_SLEEP */ Not there. AFAIU we discussed to make unregister_pm_notifier() having stubs for !PM_SLEEP.
I noticed that both register_pm_notifier and unregister_pm_notifier() has no-op defined already for !CONFIG_PM_SLEEP. So don’t need to check flag anywhere. Thanks for feedback. -----Original Message----- From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com] Sent: Wednesday, May 31, 2017 3:13 PM To: Kushwaha, Priyalee <priyalee.kushwaha@intel.com> Cc: dvhart@infradead.org; Chakravarty, Souvik K <souvik.k.chakravarty@intel.com>; Andy Shevchenko <andy@infradead.org>; linux-kernel@vger.kernel.org; Platform Driver <platform-driver-x86@vger.kernel.org> Subject: Re: [PATCH v2 1/1] intel_telemetry_debugfs: fix oops found while load/unload module test On Fri, Jun 2, 2017 at 12:33 AM, <priyalee.kushwaha@intel.com> wrote: > This fix oops found while testing load/unload test of > intel_telemetry_debugfs module. Module_init uses register_pm_notifier > for PM callbacks, but unregister_pm_notifier was missing from > module_exit. > +#ifdef CONFIG_PM_SLEEP > + unregister_pm_notifier(&pm_notifier); > +#endif /* CONFIG_PM_SLEEP */ Neither here > +#ifdef CONFIG_PM_SLEEP > + unregister_pm_notifier(&pm_notifier); > +#endif /* CONFIG_PM_SLEEP */ Not there. AFAIU we discussed to make unregister_pm_notifier() having stubs for !PM_SLEEP. -- With Best Regards, Andy Shevchenko
diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c index ef29f18..30f70b5 100644 --- a/drivers/platform/x86/intel_telemetry_debugfs.c +++ b/drivers/platform/x86/intel_telemetry_debugfs.c @@ -966,8 +966,10 @@ static int __init telemetry_debugfs_init(void) #endif /* CONFIG_PM_SLEEP */ debugfs_conf->telemetry_dbg_dir = debugfs_create_dir("telemetry", NULL); - if (!debugfs_conf->telemetry_dbg_dir) - return -ENOMEM; + if (!debugfs_conf->telemetry_dbg_dir) { + err = -ENOMEM; + goto out_pm; + } f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO, debugfs_conf->telemetry_dbg_dir, NULL, @@ -1014,6 +1016,10 @@ static int __init telemetry_debugfs_init(void) out: debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir); debugfs_conf->telemetry_dbg_dir = NULL; +out_pm: +#ifdef CONFIG_PM_SLEEP + unregister_pm_notifier(&pm_notifier); +#endif /* CONFIG_PM_SLEEP */ return err; } @@ -1022,6 +1028,9 @@ static void __exit telemetry_debugfs_exit(void) { debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir); debugfs_conf->telemetry_dbg_dir = NULL; +#ifdef CONFIG_PM_SLEEP + unregister_pm_notifier(&pm_notifier); +#endif /* CONFIG_PM_SLEEP */ } late_initcall(telemetry_debugfs_init);