spin_lock_irqsave first used and then unused

Philipp Hortmann philipp.g.hortmann at gmail.com
Sun Apr 30 04:31:09 EDT 2023


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) {

				if (rf_wait_counter > 100) {
						    "%s(): Timeout waiting for RF change.\n",
					return false;
		} else {
			priv->rf_change_in_progress = true;
			spin_unlock_irqrestore(&priv->rf_ps_lock, flag);

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