* [PATCH] rtc: isl1208: fix error handling in isl1208_probe()
@ 2018-08-08 22:13 Alexey Khoroshilov
2018-09-15 11:49 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2018-08-08 22:13 UTC (permalink / raw)
To: Denis Osterland, Michael Grzeschik, Alessandro Zummo,
Alexandre Belloni
Cc: Alexey Khoroshilov, linux-rtc, linux-kernel, ldv-project
After moving rtc_register_device() sysfs group is left unremoved
on the error path.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: 236b7187034e ("rtc: isl1208: switch to rtc_register_device")
---
drivers/rtc/rtc-isl1208.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 1a2c38cc0178..4b5df9bfb8d4 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -674,7 +674,12 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
}
}
- return rtc_register_device(rtc);
+ rc = rtc_register_device(rtc);
+ if (rc) {
+ sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
+ return rc;
+ }
+ return 0;
}
static int
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: isl1208: fix error handling in isl1208_probe()
2018-08-08 22:13 [PATCH] rtc: isl1208: fix error handling in isl1208_probe() Alexey Khoroshilov
@ 2018-09-15 11:49 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2018-09-15 11:49 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Denis Osterland, Michael Grzeschik, Alessandro Zummo, linux-rtc,
linux-kernel, ldv-project
Hello Alexey,
On 09/08/2018 01:13:07+0300, Alexey Khoroshilov wrote:
> After moving rtc_register_device() sysfs group is left unremoved
> on the error path.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Fixes: 236b7187034e ("rtc: isl1208: switch to rtc_register_device")
Thank you for that report, I've fixed it that way which also avoid the
sysfs race:
http://patchwork.ozlabs.org/patch/970216/
> ---
> drivers/rtc/rtc-isl1208.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
> index 1a2c38cc0178..4b5df9bfb8d4 100644
> --- a/drivers/rtc/rtc-isl1208.c
> +++ b/drivers/rtc/rtc-isl1208.c
> @@ -674,7 +674,12 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
> }
> }
>
> - return rtc_register_device(rtc);
> + rc = rtc_register_device(rtc);
> + if (rc) {
> + sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
> + return rc;
> + }
> + return 0;
> }
>
> static int
> --
> 2.7.4
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-15 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-08 22:13 [PATCH] rtc: isl1208: fix error handling in isl1208_probe() Alexey Khoroshilov
2018-09-15 11:49 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).