spin_lock_irqsave first used and then unused
Philipp Hortmann
philipp.g.hortmann at gmail.com
Sun Apr 30 04:31:09 EDT 2023
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
More information about the Kernelnewbies
mailing list