All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
@ 2022-04-21 14:35 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2022-04-21 14:35 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Mark Brown,
	Maxime Ripard, Arnd Bergmann, Olof Johansson
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-arm-kernel, linux-sunxi

This code is really spurious.
It always returns an ERR_PTR, even when err is known to be 0 and calls
put_device() after a successful device_register() call.

It is likely that the return statement in the normal path is missing.
Add 'return rdev;' to fix it.

Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is completely speculative and compile tested only.
---
 drivers/bus/sunxi-rsb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 4566e730ef2b..60b082fe2ed0 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -227,6 +227,8 @@ static struct sunxi_rsb_device *sunxi_rsb_device_create(struct sunxi_rsb *rsb,
 
 	dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev));
 
+	return rdev;
+
 err_device_add:
 	put_device(&rdev->dev);
 
-- 
2.32.0


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

* [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
@ 2022-04-21 14:35 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2022-04-21 14:35 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Mark Brown,
	Maxime Ripard, Arnd Bergmann, Olof Johansson
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-arm-kernel, linux-sunxi

This code is really spurious.
It always returns an ERR_PTR, even when err is known to be 0 and calls
put_device() after a successful device_register() call.

It is likely that the return statement in the normal path is missing.
Add 'return rdev;' to fix it.

Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is completely speculative and compile tested only.
---
 drivers/bus/sunxi-rsb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 4566e730ef2b..60b082fe2ed0 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -227,6 +227,8 @@ static struct sunxi_rsb_device *sunxi_rsb_device_create(struct sunxi_rsb *rsb,
 
 	dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev));
 
+	return rdev;
+
 err_device_add:
 	put_device(&rdev->dev);
 
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
  2022-04-21 14:35 ` Christophe JAILLET
@ 2022-04-23 19:39   ` Samuel Holland
  -1 siblings, 0 replies; 6+ messages in thread
From: Samuel Holland @ 2022-04-23 19:39 UTC (permalink / raw)
  To: Christophe JAILLET, Chen-Yu Tsai, Jernej Skrabec, Mark Brown,
	Maxime Ripard, Arnd Bergmann, Olof Johansson
  Cc: linux-kernel, kernel-janitors, linux-arm-kernel, linux-sunxi

On 4/21/22 9:35 AM, Christophe JAILLET wrote:
> This code is really spurious.
> It always returns an ERR_PTR, even when err is known to be 0 and calls
> put_device() after a successful device_register() call.
> 
> It is likely that the return statement in the normal path is missing.
> Add 'return rdev;' to fix it.

Thanks for the patch. This definitely looks to be the case.

> Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>

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

* Re: [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
@ 2022-04-23 19:39   ` Samuel Holland
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Holland @ 2022-04-23 19:39 UTC (permalink / raw)
  To: Christophe JAILLET, Chen-Yu Tsai, Jernej Skrabec, Mark Brown,
	Maxime Ripard, Arnd Bergmann, Olof Johansson
  Cc: linux-kernel, kernel-janitors, linux-arm-kernel, linux-sunxi

On 4/21/22 9:35 AM, Christophe JAILLET wrote:
> This code is really spurious.
> It always returns an ERR_PTR, even when err is known to be 0 and calls
> put_device() after a successful device_register() call.
> 
> It is likely that the return statement in the normal path is missing.
> Add 'return rdev;' to fix it.

Thanks for the patch. This definitely looks to be the case.

> Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: Re: [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
  2022-04-23 19:39   ` Samuel Holland
@ 2022-04-25 17:31     ` Jernej Škrabec
  -1 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2022-04-25 17:31 UTC (permalink / raw)
  To: Christophe JAILLET, Chen-Yu Tsai, Mark Brown, Maxime Ripard,
	Arnd Bergmann, Olof Johansson, Samuel Holland
  Cc: linux-kernel, kernel-janitors, linux-arm-kernel, linux-sunxi

Dne sobota, 23. april 2022 ob 21:39:45 CEST je Samuel Holland napisal(a):
> On 4/21/22 9:35 AM, Christophe JAILLET wrote:
> > This code is really spurious.
> > It always returns an ERR_PTR, even when err is known to be 0 and calls
> > put_device() after a successful device_register() call.
> > 
> > It is likely that the return statement in the normal path is missing.
> > Add 'return rdev;' to fix it.
> 
> Thanks for the patch. This definitely looks to be the case.
> 
> > Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced 
Serial Bus")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Reviewed-by: Samuel Holland <samuel@sholland.org>
> Tested-by: Samuel Holland <samuel@sholland.org>
> 

Applied to sunxi/fixes-for-5.18, thanks!

Best regards,
Jernej



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

* Re: Re: [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create()
@ 2022-04-25 17:31     ` Jernej Škrabec
  0 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2022-04-25 17:31 UTC (permalink / raw)
  To: Christophe JAILLET, Chen-Yu Tsai, Mark Brown, Maxime Ripard,
	Arnd Bergmann, Olof Johansson, Samuel Holland
  Cc: linux-kernel, kernel-janitors, linux-arm-kernel, linux-sunxi

Dne sobota, 23. april 2022 ob 21:39:45 CEST je Samuel Holland napisal(a):
> On 4/21/22 9:35 AM, Christophe JAILLET wrote:
> > This code is really spurious.
> > It always returns an ERR_PTR, even when err is known to be 0 and calls
> > put_device() after a successful device_register() call.
> > 
> > It is likely that the return statement in the normal path is missing.
> > Add 'return rdev;' to fix it.
> 
> Thanks for the patch. This definitely looks to be the case.
> 
> > Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced 
Serial Bus")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Reviewed-by: Samuel Holland <samuel@sholland.org>
> Tested-by: Samuel Holland <samuel@sholland.org>
> 

Applied to sunxi/fixes-for-5.18, thanks!

Best regards,
Jernej



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-04-25 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 14:35 [PATCH] bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create() Christophe JAILLET
2022-04-21 14:35 ` Christophe JAILLET
2022-04-23 19:39 ` Samuel Holland
2022-04-23 19:39   ` Samuel Holland
2022-04-25 17:31   ` Jernej Škrabec
2022-04-25 17:31     ` Jernej Škrabec

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.