linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] treewide: drop check because i2c_unregister_device() is NULL safe
@ 2023-09-22  8:04 Wolfram Sang
  2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Wolfram Sang @ 2023-09-22  8:04 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Wolfram Sang, linux-kernel, linux-media, linux-usb

Fix the few drivers missing that i2c_unregister_device() is NULL safe.
One is left, but this needs discussion and refactoring and will be
sorted out independently.


Wolfram Sang (3):
  usb: typec: drop check because i2c_unregister_device() is NULL safe
  media: i2c: drop check because i2c_unregister_device() is NULL safe
  media: dvb-frontends: drop check because i2c_unregister_device() is
    NULL safe

 drivers/media/dvb-frontends/m88ds3103.c | 3 +--
 drivers/media/i2c/rdacm20.c             | 3 +--
 drivers/usb/typec/anx7411.c             | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

-- 
2.30.2


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

* [PATCH 1/3] usb: typec: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 [PATCH 0/3] treewide: drop check because i2c_unregister_device() is NULL safe Wolfram Sang
@ 2023-09-22  8:04 ` Wolfram Sang
  2023-09-22 10:54   ` Heikki Krogerus
                     ` (2 more replies)
  2023-09-22  8:04 ` [PATCH 2/3] media: i2c: " Wolfram Sang
  2023-09-22  8:04 ` [PATCH 3/3] media: dvb-frontends: " Wolfram Sang
  2 siblings, 3 replies; 12+ messages in thread
From: Wolfram Sang @ 2023-09-22  8:04 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Heikki Krogerus, Greg Kroah-Hartman, linux-usb,
	linux-kernel

No need to check the argument of i2c_unregister_device() because the
function itself does it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. Please apply to your tree.

 drivers/usb/typec/anx7411.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
index 221604f933a4..b12a07edc71b 100644
--- a/drivers/usb/typec/anx7411.c
+++ b/drivers/usb/typec/anx7411.c
@@ -1550,8 +1550,7 @@ static void anx7411_i2c_remove(struct i2c_client *client)
 	if (plat->workqueue)
 		destroy_workqueue(plat->workqueue);
 
-	if (plat->spi_client)
-		i2c_unregister_device(plat->spi_client);
+	i2c_unregister_device(plat->spi_client);
 
 	if (plat->typec.role_sw)
 		usb_role_switch_put(plat->typec.role_sw);
-- 
2.30.2


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

* [PATCH 2/3] media: i2c: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 [PATCH 0/3] treewide: drop check because i2c_unregister_device() is NULL safe Wolfram Sang
  2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
@ 2023-09-22  8:04 ` Wolfram Sang
  2023-09-22  8:14   ` Kieran Bingham
                     ` (2 more replies)
  2023-09-22  8:04 ` [PATCH 3/3] media: dvb-frontends: " Wolfram Sang
  2 siblings, 3 replies; 12+ messages in thread
From: Wolfram Sang @ 2023-09-22  8:04 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Jacopo Mondi, Kieran Bingham, Laurent Pinchart,
	Niklas Söderlund, Mauro Carvalho Chehab, linux-media,
	linux-kernel

No need to check the argument of i2c_unregister_device() because the
function itself does it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. Please apply to your tree.

 drivers/media/i2c/rdacm20.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
index f4e2e2f3972a..b4647bda8c21 100644
--- a/drivers/media/i2c/rdacm20.c
+++ b/drivers/media/i2c/rdacm20.c
@@ -625,8 +625,7 @@ static int rdacm20_probe(struct i2c_client *client)
 	v4l2_ctrl_handler_free(&dev->ctrls);
 error:
 	media_entity_cleanup(&dev->sd.entity);
-	if (dev->sensor)
-		i2c_unregister_device(dev->sensor);
+	i2c_unregister_device(dev->sensor);
 
 	dev_err(&client->dev, "probe failed\n");
 
-- 
2.30.2


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

* [PATCH 3/3] media: dvb-frontends: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 [PATCH 0/3] treewide: drop check because i2c_unregister_device() is NULL safe Wolfram Sang
  2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
  2023-09-22  8:04 ` [PATCH 2/3] media: i2c: " Wolfram Sang
@ 2023-09-22  8:04 ` Wolfram Sang
  2023-09-22 11:49   ` Kieran Bingham
  2023-09-25 11:52   ` Geert Uytterhoeven
  2 siblings, 2 replies; 12+ messages in thread
From: Wolfram Sang @ 2023-09-22  8:04 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Antti Palosaari, Mauro Carvalho Chehab,
	linux-media, linux-kernel

No need to check the argument of i2c_unregister_device() because the
function itself does it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. Please apply to your tree.

 drivers/media/dvb-frontends/m88ds3103.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
index cf037b61b226..26c67ef05d13 100644
--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -1920,8 +1920,7 @@ static void m88ds3103_remove(struct i2c_client *client)
 
 	dev_dbg(&client->dev, "\n");
 
-	if (dev->dt_client)
-		i2c_unregister_device(dev->dt_client);
+	i2c_unregister_device(dev->dt_client);
 
 	i2c_mux_del_adapters(dev->muxc);
 
-- 
2.30.2


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

* Re: [PATCH 2/3] media: i2c: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 2/3] media: i2c: " Wolfram Sang
@ 2023-09-22  8:14   ` Kieran Bingham
  2023-09-25 11:50   ` Geert Uytterhoeven
  2023-09-25 11:59   ` Laurent Pinchart
  2 siblings, 0 replies; 12+ messages in thread
From: Kieran Bingham @ 2023-09-22  8:14 UTC (permalink / raw)
  To: Wolfram Sang, linux-renesas-soc
  Cc: Wolfram Sang, Jacopo Mondi, Laurent Pinchart,
	Niklas Söderlund, Mauro Carvalho Chehab, linux-media,
	linux-kernel

Hi Wolfram,

Quoting Wolfram Sang (2023-09-22 09:04:19)
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.

Well spotted!

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> Build tested only. Please apply to your tree.
> 
>  drivers/media/i2c/rdacm20.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
> index f4e2e2f3972a..b4647bda8c21 100644
> --- a/drivers/media/i2c/rdacm20.c
> +++ b/drivers/media/i2c/rdacm20.c
> @@ -625,8 +625,7 @@ static int rdacm20_probe(struct i2c_client *client)
>         v4l2_ctrl_handler_free(&dev->ctrls);
>  error:
>         media_entity_cleanup(&dev->sd.entity);
> -       if (dev->sensor)
> -               i2c_unregister_device(dev->sensor);
> +       i2c_unregister_device(dev->sensor);
>  
>         dev_err(&client->dev, "probe failed\n");
>  
> -- 
> 2.30.2
>

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

* Re: [PATCH 1/3] usb: typec: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
@ 2023-09-22 10:54   ` Heikki Krogerus
  2023-09-22 11:50   ` Kieran Bingham
  2023-09-25  7:44   ` Geert Uytterhoeven
  2 siblings, 0 replies; 12+ messages in thread
From: Heikki Krogerus @ 2023-09-22 10:54 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Greg Kroah-Hartman, linux-usb, linux-kernel

On Fri, Sep 22, 2023 at 10:04:18AM +0200, Wolfram Sang wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Build tested only. Please apply to your tree.
> 
>  drivers/usb/typec/anx7411.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index 221604f933a4..b12a07edc71b 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -1550,8 +1550,7 @@ static void anx7411_i2c_remove(struct i2c_client *client)
>  	if (plat->workqueue)
>  		destroy_workqueue(plat->workqueue);
>  
> -	if (plat->spi_client)
> -		i2c_unregister_device(plat->spi_client);
> +	i2c_unregister_device(plat->spi_client);
>  
>  	if (plat->typec.role_sw)
>  		usb_role_switch_put(plat->typec.role_sw);
> -- 
> 2.30.2

-- 
heikki

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

* Re: [PATCH 3/3] media: dvb-frontends: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 3/3] media: dvb-frontends: " Wolfram Sang
@ 2023-09-22 11:49   ` Kieran Bingham
  2023-09-25 11:52   ` Geert Uytterhoeven
  1 sibling, 0 replies; 12+ messages in thread
From: Kieran Bingham @ 2023-09-22 11:49 UTC (permalink / raw)
  To: Wolfram Sang, linux-renesas-soc
  Cc: Wolfram Sang, Antti Palosaari, Mauro Carvalho Chehab,
	linux-media, linux-kernel

Quoting Wolfram Sang (2023-09-22 09:04:20)
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
> 

Having reviewed the RDACM20 patch, I think I can say this looks accurate
too.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> Build tested only. Please apply to your tree.
> 
>  drivers/media/dvb-frontends/m88ds3103.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
> index cf037b61b226..26c67ef05d13 100644
> --- a/drivers/media/dvb-frontends/m88ds3103.c
> +++ b/drivers/media/dvb-frontends/m88ds3103.c
> @@ -1920,8 +1920,7 @@ static void m88ds3103_remove(struct i2c_client *client)
>  
>         dev_dbg(&client->dev, "\n");
>  
> -       if (dev->dt_client)
> -               i2c_unregister_device(dev->dt_client);
> +       i2c_unregister_device(dev->dt_client);
>  
>         i2c_mux_del_adapters(dev->muxc);
>  
> -- 
> 2.30.2
>

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

* Re: [PATCH 1/3] usb: typec: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
  2023-09-22 10:54   ` Heikki Krogerus
@ 2023-09-22 11:50   ` Kieran Bingham
  2023-09-25  7:44   ` Geert Uytterhoeven
  2 siblings, 0 replies; 12+ messages in thread
From: Kieran Bingham @ 2023-09-22 11:50 UTC (permalink / raw)
  To: Wolfram Sang, linux-renesas-soc
  Cc: Wolfram Sang, Heikki Krogerus, Greg Kroah-Hartman, linux-usb,
	linux-kernel

Quoting Wolfram Sang (2023-09-22 09:04:18)
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

And this is the same pattern here so:

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
> Build tested only. Please apply to your tree.
> 
>  drivers/usb/typec/anx7411.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index 221604f933a4..b12a07edc71b 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -1550,8 +1550,7 @@ static void anx7411_i2c_remove(struct i2c_client *client)
>         if (plat->workqueue)
>                 destroy_workqueue(plat->workqueue);
>  
> -       if (plat->spi_client)
> -               i2c_unregister_device(plat->spi_client);
> +       i2c_unregister_device(plat->spi_client);
>  
>         if (plat->typec.role_sw)
>                 usb_role_switch_put(plat->typec.role_sw);
> -- 
> 2.30.2
>

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

* Re: [PATCH 1/3] usb: typec: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
  2023-09-22 10:54   ` Heikki Krogerus
  2023-09-22 11:50   ` Kieran Bingham
@ 2023-09-25  7:44   ` Geert Uytterhoeven
  2 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2023-09-25  7:44 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Heikki Krogerus, Greg Kroah-Hartman,
	linux-usb, linux-kernel

On Fri, Sep 22, 2023 at 12:44 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/3] media: i2c: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 2/3] media: i2c: " Wolfram Sang
  2023-09-22  8:14   ` Kieran Bingham
@ 2023-09-25 11:50   ` Geert Uytterhoeven
  2023-09-25 11:59   ` Laurent Pinchart
  2 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2023-09-25 11:50 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Jacopo Mondi, Kieran Bingham,
	Laurent Pinchart, Niklas Söderlund, Mauro Carvalho Chehab,
	linux-media, linux-kernel

On Fri, Sep 22, 2023 at 4:45 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 3/3] media: dvb-frontends: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 3/3] media: dvb-frontends: " Wolfram Sang
  2023-09-22 11:49   ` Kieran Bingham
@ 2023-09-25 11:52   ` Geert Uytterhoeven
  1 sibling, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2023-09-25 11:52 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Antti Palosaari, Mauro Carvalho Chehab,
	linux-media, linux-kernel

On Fri, Sep 22, 2023 at 1:45 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/3] media: i2c: drop check because i2c_unregister_device() is NULL safe
  2023-09-22  8:04 ` [PATCH 2/3] media: i2c: " Wolfram Sang
  2023-09-22  8:14   ` Kieran Bingham
  2023-09-25 11:50   ` Geert Uytterhoeven
@ 2023-09-25 11:59   ` Laurent Pinchart
  2 siblings, 0 replies; 12+ messages in thread
From: Laurent Pinchart @ 2023-09-25 11:59 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Jacopo Mondi, Kieran Bingham,
	Niklas Söderlund, Mauro Carvalho Chehab, linux-media,
	linux-kernel

On Fri, Sep 22, 2023 at 10:04:19AM +0200, Wolfram Sang wrote:
> No need to check the argument of i2c_unregister_device() because the
> function itself does it.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

I'll take this in my tree and send a pull request if Sakari doesn't pick
up the patch himself.

> ---
> Build tested only. Please apply to your tree.
> 
>  drivers/media/i2c/rdacm20.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
> index f4e2e2f3972a..b4647bda8c21 100644
> --- a/drivers/media/i2c/rdacm20.c
> +++ b/drivers/media/i2c/rdacm20.c
> @@ -625,8 +625,7 @@ static int rdacm20_probe(struct i2c_client *client)
>  	v4l2_ctrl_handler_free(&dev->ctrls);
>  error:
>  	media_entity_cleanup(&dev->sd.entity);
> -	if (dev->sensor)
> -		i2c_unregister_device(dev->sensor);
> +	i2c_unregister_device(dev->sensor);
>  
>  	dev_err(&client->dev, "probe failed\n");
>  

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2023-09-25 11:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22  8:04 [PATCH 0/3] treewide: drop check because i2c_unregister_device() is NULL safe Wolfram Sang
2023-09-22  8:04 ` [PATCH 1/3] usb: typec: " Wolfram Sang
2023-09-22 10:54   ` Heikki Krogerus
2023-09-22 11:50   ` Kieran Bingham
2023-09-25  7:44   ` Geert Uytterhoeven
2023-09-22  8:04 ` [PATCH 2/3] media: i2c: " Wolfram Sang
2023-09-22  8:14   ` Kieran Bingham
2023-09-25 11:50   ` Geert Uytterhoeven
2023-09-25 11:59   ` Laurent Pinchart
2023-09-22  8:04 ` [PATCH 3/3] media: dvb-frontends: " Wolfram Sang
2023-09-22 11:49   ` Kieran Bingham
2023-09-25 11:52   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).