summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2016-02-15 23:49:07 +0900
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-03-14 17:08:19 +0100
commit9dbe3852964166fdf3ac4aff4cb67311dfa243bc (patch)
tree906b99d286c437cc7621751a86fbb1fd09c398c0
parent0a966c07323a0506522587e8de96f542ebac04ba (diff)
downloadlinux-stable-9dbe3852964166fdf3ac4aff4cb67311dfa243bc.tar.gz
linux-stable-9dbe3852964166fdf3ac4aff4cb67311dfa243bc.tar.bz2
linux-stable-9dbe3852964166fdf3ac4aff4cb67311dfa243bc.zip
rtc: rx8025: protect ctrl1 register update by rtc->ops_lock
The ctrl1 register is accessed by alarm operations. But it is updated in threaded interrupt handler without acquiring rtc->ops_lock. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r--drivers/rtc/rtc-rx8025.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index 18240f526ade..259995281e0d 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -146,8 +146,10 @@ static irqreturn_t rx8025_handle_irq(int irq, void *dev_id)
{
struct i2c_client *client = dev_id;
struct rx8025_data *rx8025 = i2c_get_clientdata(client);
+ struct mutex *lock = &rx8025->rtc->ops_lock;
int status;
+ mutex_lock(lock);
status = rx8025_read_reg(client, RX8025_REG_CTRL2);
if (status < 0)
goto out;
@@ -172,6 +174,8 @@ static irqreturn_t rx8025_handle_irq(int irq, void *dev_id)
}
out:
+ mutex_unlock(lock);
+
return IRQ_HANDLED;
}