diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-04-07 12:28:52 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2020-04-15 09:58:24 +0200 |
commit | 11ddbdfb68e4f9791e4bd4f8d7c87d3f19670967 (patch) | |
tree | 5ddf3e77e46932fe000efd9d7b0c77ed284faf4d /drivers/rtc | |
parent | 944ed452eb1b4241c8bd693b8b689fe8b888c445 (diff) |
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")
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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-rc5t619.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-rc5t619.c b/drivers/rtc/rtc-rc5t619.c index 24e386ecbc7e..dd1a20977478 100644 --- a/drivers/rtc/rtc-rc5t619.c +++ b/drivers/rtc/rtc-rc5t619.c @@ -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; |