All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: gamecube: Fix an IS_ERR() vs NULL check
@ 2022-01-07  7:33 Dan Carpenter
  2022-01-09 12:31 ` Emmanuel Gil Peyrot
  2022-01-16 22:36 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-01-07  7:33 UTC (permalink / raw)
  To: Alessandro Zummo, Emmanuel Gil Peyrot
  Cc: Alexandre Belloni, Michael Ellerman, linux-rtc, linux-kernel,
	kernel-janitors

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

Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/rtc/rtc-gamecube.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
index 98128746171e..f717b36f4738 100644
--- a/drivers/rtc/rtc-gamecube.c
+++ b/drivers/rtc/rtc-gamecube.c
@@ -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))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: gamecube: Fix an IS_ERR() vs NULL check
  2022-01-07  7:33 [PATCH] rtc: gamecube: Fix an IS_ERR() vs NULL check Dan Carpenter
@ 2022-01-09 12:31 ` Emmanuel Gil Peyrot
  2022-01-16 22:36 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Emmanuel Gil Peyrot @ 2022-01-09 12:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alessandro Zummo, Emmanuel Gil Peyrot, Alexandre Belloni,
	Michael Ellerman, linux-rtc, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

On Fri, Jan 07, 2022 at 10:33:40AM +0300, Dan Carpenter wrote:
> The devm_kzalloc() function returns NULL on error, it doesn't return
> error pointers.

Good catch, thanks!

Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>

> 
> Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/rtc/rtc-gamecube.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c
> index 98128746171e..f717b36f4738 100644
> --- a/drivers/rtc/rtc-gamecube.c
> +++ b/drivers/rtc/rtc-gamecube.c
> @@ -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))
> -- 
> 2.20.1

-- 
Emmanuel Gil Peyrot

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: gamecube: Fix an IS_ERR() vs NULL check
  2022-01-07  7:33 [PATCH] rtc: gamecube: Fix an IS_ERR() vs NULL check Dan Carpenter
  2022-01-09 12:31 ` Emmanuel Gil Peyrot
@ 2022-01-16 22:36 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2022-01-16 22:36 UTC (permalink / raw)
  To: Alessandro Zummo, Emmanuel Gil Peyrot, Dan Carpenter
  Cc: Alexandre Belloni, linux-kernel, kernel-janitors, linux-rtc,
	Michael Ellerman

On Fri, 7 Jan 2022 10:33:40 +0300, Dan Carpenter wrote:
> The devm_kzalloc() function returns NULL on error, it doesn't return
> error pointers.
> 
> 

Applied, thanks!

[1/1] rtc: gamecube: Fix an IS_ERR() vs NULL check
      commit: 900ed72c8a190e8c0b87cb17abc645b8ec713011

Best regards,
-- 
Alexandre Belloni <alexandre.belloni@bootlin.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-16 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07  7:33 [PATCH] rtc: gamecube: Fix an IS_ERR() vs NULL check Dan Carpenter
2022-01-09 12:31 ` Emmanuel Gil Peyrot
2022-01-16 22:36 ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.