From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: spin_lock_irqsave first used and then unused
Date: Sun, 30 Apr 2023 10:31:09 +0200 [thread overview]
Message-ID: <6a40d39a-c850-f330-eded-2f55127359b3@gmail.com> (raw)
Hi,
here a piece of code from driver rtl8192e:
while (true) {
spin_lock_irqsave(&priv->rf_ps_lock, flag);
if (priv->rf_change_in_progress) {
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
while (priv->rf_change_in_progress) {
rf_wait_counter++;
mdelay(1);
if (rf_wait_counter > 100) {
netdev_warn(dev,
"%s(): Timeout waiting for RF change.\n",
__func__);
return false;
}
}
} else {
priv->rf_change_in_progress = true;
spin_unlock_irqrestore(&priv->rf_ps_lock, flag);
break;
}
}
For me something is wrong here. First the access of
priv->rf_change_in_progress is protected by a spin lock and then in the
while loop it is unprotected. Is this correct? For me it is required to
protected it always or protected it never.
Thanks for your support.
Bye Philipp
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next reply other threads:[~2023-04-30 8:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-30 8:31 Philipp Hortmann [this message]
[not found] ` <87o7n57b38.fsf@oltmanns.dev>
2023-04-30 15:57 ` spin_lock_irqsave first used and then unused Philipp Hortmann
2023-04-30 17:08 ` Torin Carey
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=6a40d39a-c850-f330-eded-2f55127359b3@gmail.com \
--to=philipp.g.hortmann@gmail.com \
--cc=kernelnewbies@kernelnewbies.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).