Skip to contentSkip to conversation

rtc: sun6i: Fix return value check in sun6i_rtc_clk_init()

PATCH Applied Wei Yongjun 3 participants 3 messages Feb 9, 2017 – Feb 11, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: sun6i: Fix return value check in sun6i_rtc_clk_init()

From: Wei Yongjun <[email protected]>

In case of error, the function of_io_request_and_map() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator")
---
 drivers/rtc/rtc-sun6i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-sun6i.c +1 -1
index 08510ca..39cbc12 100644
@@ -202,7 +202,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node)
 	spin_lock_init(&rtc->lock);
 
 	rtc->base = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!rtc->base) {
+	if (IS_ERR(rtc->base)) {
 		pr_crit("Can't map RTC registers");
 		return;
 	}
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function of_io_request_and_map() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator")

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170209/a15a4a4f/attachment-0001.sig>
#2 lore raw
In reply to Wei Yongjun
Quoted 6 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function of_io_request_and_map() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Quoted 6 lines
Fixes 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator")
---
 drivers/rtc/rtc-sun6i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com