Re: [patch -mm] rtc: pm8xxx: unlock on error in pm8xxx_rtc_set_time()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/16/2014 11:01 PM, Andrew Morton wrote:
> On Thu, 16 Oct 2014 16:57:07 +0300 Stanimir Varbanov <svarbanov@xxxxxxxxxx> wrote:
> 
>> I'm wondering for a better fix to this. Isn't better to avoid this
>> conditional call to spin_unlock_irqrestore() and lock regmap writes
>> every time without care is the alarm is enabled or not.
> 
> That's what I was thinking.  This?

Yes, this should be the right fix.	

> 
> --- a/drivers/rtc/rtc-pm8xxx.c~rtc-pm8xxx-rework-to-support-pm8941-rtc-fix
> +++ a/drivers/rtc/rtc-pm8xxx.c
> @@ -113,8 +113,6 @@ static int pm8xxx_rtc_set_time(struct de
>  			dev_err(dev, "Write to RTC control register failed\n");
>  			goto rtc_rw_fail;
>  		}
> -	} else {
> -		spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
>  	}
>  
>  	/* Write 0 to Byte[0] */
> @@ -149,8 +147,7 @@ static int pm8xxx_rtc_set_time(struct de
>  	}
>  
>  rtc_rw_fail:
> -	if (alarm_enabled)
> -		spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
> +	spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
>  
>  	return rc;
>  }
> _
> 


-- 
regards,
Stan
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux