Skip to content

Commit

Permalink
rtc: gamecube: Fix an IS_ERR() vs NULL check
Browse files Browse the repository at this point in the history
The devm_kzalloc() function returns NULL on error, it doesn't return
error pointers.

Fixes: 8655940 ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220107073340.GF22086@kili
  • Loading branch information
Dan Carpenter authored and Alexandre Belloni committed Jan 16, 2022
1 parent 7372971 commit 900ed72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/rtc/rtc-gamecube.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ static int gamecube_rtc_probe(struct platform_device *pdev)
int ret;

d = devm_kzalloc(dev, sizeof(struct priv), GFP_KERNEL);
if (IS_ERR(d))
return PTR_ERR(d);
if (!d)
return -ENOMEM;

d->iob = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(d->iob))
Expand Down

0 comments on commit 900ed72

Please sign in to comment.