Skip to contentSkip to conversation

rtc: rc5t619: Fix an ERR_PTR vs NULL check

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 7, 2020 – Apr 15, 2020

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

PATCH 1/1 rtc: rc5t619: Fix an ERR_PTR vs NULL check

The devm_kzalloc() function returns NULL on error, it doesn't return error pointers so this check doesn't work.

Fixes 540d1e15393d ("rtc: rc5t619: Add Ricoh RC5T619 RTC driver")
---
 drivers/rtc/rtc-rc5t619.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-rc5t619.c +1 -3
index 24e386ecbc7e..dd1a20977478 100644
@@ -356,10 +356,8 @@ static int rc5t619_rtc_probe(struct platform_device *pdev)
 	int err;
 
 	rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL);
-	if (IS_ERR(rtc)) {
-		err = PTR_ERR(rtc);
+	if (!rtc)
 		return -ENOMEM;
-	}
 
 	rtc->rn5t618 = rn5t618;
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Dan Carpenter

The devm_kzalloc() function returns NULL on error, it doesn't return error pointers so this check doesn't work.

Fixes 540d1e15393d ("rtc: rc5t619: Add Ricoh RC5T619 RTC driver")
---
 drivers/rtc/rtc-rc5t619.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com