[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210802230313.GA1480457@pc>
Date: Tue, 3 Aug 2021 00:03:13 +0100
From: Salah Triki <salah.triki@...il.com>
To: Alan Stern <stern@...land.harvard.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, usb-storage@...ts.one-eyed-alien.net,
linux-kernel@...r.kernel.org
Subject: [PATCH] usb: storage: realtek_cr: get lock before calling
usb_enable_autosuspend()
Based on the documentation of usb_enable_autosuspend(), the
caller must hold udev's device lock.
Signed-off-by: Salah Triki <salah.triki@...il.com>
---
drivers/usb/storage/realtek_cr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 3789698d9d3c..6948d6fdad39 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -918,9 +918,13 @@ static int realtek_cr_autosuspend_setup(struct us_data *us)
timer_setup(&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn, 0);
fw5895_init(us);
+ usb_lock_device(us->pusb_dev);
+
/* enable autosuspend function of the usb device */
usb_enable_autosuspend(us->pusb_dev);
+ usb_unlock_device(us->pusb_dev);
+
return 0;
}
#endif
--
2.25.1
Powered by blists - more mailing lists