mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
rtc: ds1307: use guard
Use guard() to simplify error handling Link: https://patch.msgid.link/20261019211827.126262-6-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
d1fd5232fa
commit
3571eedcfc
|
|
@ -579,28 +579,27 @@ static irqreturn_t rx8130_irq(int irq, void *dev_id)
|
|||
u8 ctl[3];
|
||||
int ret;
|
||||
|
||||
rtc_lock(ds1307->rtc);
|
||||
guard(rtc_ops)(ds1307->rtc);
|
||||
|
||||
/* Read control registers. */
|
||||
ret = regmap_bulk_read(ds1307->regmap, RX8130_REG_EXTENSION, ctl,
|
||||
sizeof(ctl));
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
return IRQ_HANDLED;
|
||||
|
||||
if (!(ctl[1] & RX8130_REG_FLAG_AF))
|
||||
goto out;
|
||||
return IRQ_HANDLED;
|
||||
|
||||
ctl[1] &= ~RX8130_REG_FLAG_AF;
|
||||
ctl[2] &= ~RX8130_REG_CONTROL0_AIE;
|
||||
|
||||
ret = regmap_bulk_write(ds1307->regmap, RX8130_REG_EXTENSION, ctl,
|
||||
sizeof(ctl));
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
return IRQ_HANDLED;
|
||||
|
||||
rtc_update_irq(ds1307->rtc, 1, RTC_AF | RTC_IRQF);
|
||||
|
||||
out:
|
||||
rtc_unlock(ds1307->rtc);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user