From: Salah Triki <salah.triki@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
linux-kernel@vger.kernel.org
Subject: [PATCH] usb: storage: realtek_cr: get lock before calling usb_enable_autosuspend()
Date: Tue, 3 Aug 2021 00:03:13 +0100 [thread overview]
Message-ID: <20210802230313.GA1480457@pc> (raw)
Based on the documentation of usb_enable_autosuspend(), the
caller must hold udev's device lock.
Signed-off-by: Salah Triki <salah.triki@gmail.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
next reply other threads:[~2021-08-02 23:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 23:03 Salah Triki [this message]
2021-08-03 0:56 ` [PATCH] usb: storage: realtek_cr: get lock before calling usb_enable_autosuspend() Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210802230313.GA1480457@pc \
--to=salah.triki@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox