* [PATCH v2] rtc: stmp3xxx: print message on error
@ 2016-04-30 19:11 Sudip Mukherjee
2016-05-03 11:40 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-04-30 19:11 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: linux-kernel, rtc-linux, Sudip Mukherjee
stmp3xxx_wdt_register() can fail as platform_device_alloc() or
platform_device_add() can fail. But when it fails it failed silently.
Lets print out an error message on failure so that user will atlest
know that there was some error.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
v1 - returned error while failing in the probe.
drivers/rtc/rtc-stmp3xxx.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index ca54d03..e6aaaa5 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -107,14 +107,19 @@ static struct stmp3xxx_wdt_pdata wdt_pdata = {
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
{
+ int rc = -1;
struct platform_device *wdt_pdev =
platform_device_alloc("stmp3xxx_rtc_wdt", rtc_pdev->id);
if (wdt_pdev) {
wdt_pdev->dev.parent = &rtc_pdev->dev;
wdt_pdev->dev.platform_data = &wdt_pdata;
- platform_device_add(wdt_pdev);
+ rc = platform_device_add(wdt_pdev);
}
+
+ if (rc)
+ dev_err(&rtc_pdev->dev,
+ "failed to register stmp3xxx_rtc_wdt\n");
}
#else
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] rtc: stmp3xxx: print message on error
2016-04-30 19:11 [PATCH v2] rtc: stmp3xxx: print message on error Sudip Mukherjee
@ 2016-05-03 11:40 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2016-05-03 11:40 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Alessandro Zummo, linux-kernel, rtc-linux
On 30/04/2016 at 20:11:30 +0100, Sudip Mukherjee wrote :
> stmp3xxx_wdt_register() can fail as platform_device_alloc() or
> platform_device_add() can fail. But when it fails it failed silently.
> Lets print out an error message on failure so that user will atlest
> know that there was some error.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>
> v1 - returned error while failing in the probe.
>
> drivers/rtc/rtc-stmp3xxx.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-03 11:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-30 19:11 [PATCH v2] rtc: stmp3xxx: print message on error Sudip Mukherjee
2016-05-03 11:40 ` 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).