* [PATCH] firmware: gsmi: remove sysfs entries when unload the module
@ 2011-06-29 7:57 Axel Lin
2011-07-04 18:46 ` Mike Waychison
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2011-06-29 7:57 UTC (permalink / raw)
To: linux-kernel
Cc: Mike Waychison, Duncan Laurie, Aaron Durbin, Greg Kroah-Hartman
This patch removes sysfs entries in gsmi_exit() and gsmi_init() error path.
Also move the driver successfully loaded message to the end of gsmi_init()
and return proper error if register_efivars() fails.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/firmware/google/gsmi.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index fa7f0b3..68810fd 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -869,8 +869,6 @@ static __init int gsmi_init(void)
goto out_err;
}
- printk(KERN_INFO "gsmi version " DRIVER_VERSION " loaded\n");
-
/* Register in the firmware directory */
ret = -ENOMEM;
gsmi_kobj = kobject_create_and_add("gsmi", firmware_kobj);
@@ -890,12 +888,13 @@ static __init int gsmi_init(void)
ret = sysfs_create_files(gsmi_kobj, gsmi_attrs);
if (ret) {
printk(KERN_INFO "gsmi: Failed to add attrs");
- goto out_err;
+ goto out_remove_bin_file;
}
- if (register_efivars(&efivars, &efivar_ops, gsmi_kobj)) {
+ ret = register_efivars(&efivars, &efivar_ops, gsmi_kobj);
+ if (ret) {
printk(KERN_INFO "gsmi: Failed to register efivars\n");
- goto out_err;
+ goto out_remove_sysfs_files;
}
register_reboot_notifier(&gsmi_reboot_notifier);
@@ -903,9 +902,15 @@ static __init int gsmi_init(void)
atomic_notifier_chain_register(&panic_notifier_list,
&gsmi_panic_notifier);
+ printk(KERN_INFO "gsmi version " DRIVER_VERSION " loaded\n");
+
return 0;
- out_err:
+out_remove_sysfs_files:
+ sysfs_remove_files(gsmi_kobj, gsmi_attrs);
+out_remove_bin_file:
+ sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
+out_err:
kobject_put(gsmi_kobj);
gsmi_buf_free(gsmi_dev.param_buf);
gsmi_buf_free(gsmi_dev.data_buf);
@@ -925,6 +930,8 @@ static void __exit gsmi_exit(void)
&gsmi_panic_notifier);
unregister_efivars(&efivars);
+ sysfs_remove_files(gsmi_kobj, gsmi_attrs);
+ sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
kobject_put(gsmi_kobj);
gsmi_buf_free(gsmi_dev.param_buf);
gsmi_buf_free(gsmi_dev.data_buf);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] firmware: gsmi: remove sysfs entries when unload the module
2011-06-29 7:57 [PATCH] firmware: gsmi: remove sysfs entries when unload the module Axel Lin
@ 2011-07-04 18:46 ` Mike Waychison
2011-07-05 13:26 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Mike Waychison @ 2011-07-04 18:46 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Duncan Laurie, Aaron Durbin, Greg Kroah-Hartman
On Wed, Jun 29, 2011 at 12:57 AM, Axel Lin <axel.lin@gmail.com> wrote:
>
> This patch removes sysfs entries in gsmi_exit() and gsmi_init() error path.
>
> Also move the driver successfully loaded message to the end of gsmi_init()
> and return proper error if register_efivars() fails.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mike Waychison <mikew@google.com>
Greg, can you pick this up in drivers-core?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] firmware: gsmi: remove sysfs entries when unload the module
2011-07-04 18:46 ` Mike Waychison
@ 2011-07-05 13:26 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-07-05 13:26 UTC (permalink / raw)
To: Mike Waychison; +Cc: Axel Lin, linux-kernel, Duncan Laurie, Aaron Durbin
On Mon, Jul 04, 2011 at 11:46:20AM -0700, Mike Waychison wrote:
> On Wed, Jun 29, 2011 at 12:57 AM, Axel Lin <axel.lin@gmail.com> wrote:
> >
> > This patch removes sysfs entries in gsmi_exit() and gsmi_init() error path.
> >
> > Also move the driver successfully loaded message to the end of gsmi_init()
> > and return proper error if register_efivars() fails.
> >
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> Acked-by: Mike Waychison <mikew@google.com>
>
> Greg, can you pick this up in drivers-core?
I already did last week :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-05 13:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-29 7:57 [PATCH] firmware: gsmi: remove sysfs entries when unload the module Axel Lin
2011-07-04 18:46 ` Mike Waychison
2011-07-05 13:26 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox