[PATCH v2 9/9] can: etas_es58x and peak_usb: remove useless call to usb_set_intfdata()

Vincent Mailhol
2022-12-10T09:06:51Z

The core sets the usb_interface to NULL in [1]. Also setting it to
NULL in usb_driver::disconnect() is useless.

Remove the call to usb_set_intfdata(intf, NULL) in the disconnect
function of all drivers under drivers/net/can/usb.

[1] function usb_unbind_interface() from drivers/usb/core/driver.c
Link: https://elixir.bootlin.com/linux/v6.0/source/drivers/usb/core/driver.c#L497

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 1 -
drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 --
2 files changed, 3 deletions(-)

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 0c7f7505632c..4924f0be3510 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2257,7 +2257,6 @@ static void es58x_disconnect(struct usb_interface *intf)
es58x_free_netdevs(es58x_dev);
es58x_free_urbs(es58x_dev);
devlink_free(priv_to_devlink(es58x_dev));
- usb_set_intfdata(intf, NULL);
}

static struct usb_driver es58x_driver = {
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 1d996d3320fe..c15200aebfb6 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -974,8 +974,6 @@ static void peak_usb_disconnect(struct usb_interface *intf)
free_candev(netdev);
dev_info(&intf->dev, "%s removed\n", name);
}
-
- usb_set_intfdata(intf, NULL);
}

/*
--
2.37.4