1
0
Fork 0

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: 540d1e1539 ("rtc: rc5t619: Add Ricoh RC5T619 RTC driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200407092852.GI68494@mwanda
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
alistair/sunxi64-5.8
Dan Carpenter 2020-04-07 12:28:52 +03:00 committed by Alexandre Belloni
parent 944ed452eb
commit 11ddbdfb68
1 changed files with 1 additions and 3 deletions

View File

@ -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;