diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2016-04-30 15:11:30 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-05-20 06:33:51 -0400 |
commit | 3497610a45d15bd33d1993ddd84951ad21b35ded (patch) | |
tree | 203e65e71e301fa4a50851fba5ebdb6e417457b4 | |
parent | 6fca3fc51632685635cb7143065ae74d44673871 (diff) |
rtc: stmp3xxx: print message on error
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>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | drivers/rtc/rtc-stmp3xxx.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index ca54d039da31..e6aaaa52e7fe 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c | |||
@@ -107,14 +107,19 @@ static struct stmp3xxx_wdt_pdata wdt_pdata = { | |||
107 | 107 | ||
108 | static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev) | 108 | static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev) |
109 | { | 109 | { |
110 | int rc = -1; | ||
110 | struct platform_device *wdt_pdev = | 111 | struct platform_device *wdt_pdev = |
111 | platform_device_alloc("stmp3xxx_rtc_wdt", rtc_pdev->id); | 112 | platform_device_alloc("stmp3xxx_rtc_wdt", rtc_pdev->id); |
112 | 113 | ||
113 | if (wdt_pdev) { | 114 | if (wdt_pdev) { |
114 | wdt_pdev->dev.parent = &rtc_pdev->dev; | 115 | wdt_pdev->dev.parent = &rtc_pdev->dev; |
115 | wdt_pdev->dev.platform_data = &wdt_pdata; | 116 | wdt_pdev->dev.platform_data = &wdt_pdata; |
116 | platform_device_add(wdt_pdev); | 117 | rc = platform_device_add(wdt_pdev); |
117 | } | 118 | } |
119 | |||
120 | if (rc) | ||
121 | dev_err(&rtc_pdev->dev, | ||
122 | "failed to register stmp3xxx_rtc_wdt\n"); | ||
118 | } | 123 | } |
119 | #else | 124 | #else |
120 | static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev) | 125 | static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev) |