lkml.org 
[lkml]   [2022]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb: core: Call disconnect() only if it is provided by driver
Date
A driver may use devres allocations. Disconnect handler is not needed in
this case. Allow such driver to leave .disconnect field uninitialized in
struct usb_driver instead of providing empty stub function.

Signed-off-by: Dmytro Bagrii <dimich.dmb@gmail.com>
---
drivers/usb/core/driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 355ed33a2179..d7fe440b033c 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -455,7 +455,8 @@ static int usb_unbind_interface(struct device *dev)
if (!driver->soft_unbind || udev->state == USB_STATE_NOTATTACHED)
usb_disable_interface(udev, intf, false);

- driver->disconnect(intf);
+ if (driver->disconnect)
+ driver->disconnect(intf);

/* Free streams */
for (i = 0, j = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
--
2.36.1
\
 
 \ /
  Last update: 2022-05-19 15:31    [W:1.786 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site