X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Frtc%2Frtc-dev.c;h=0114a78b7cbbe6687892cca1fad58dc76d8883f9;hb=9c1be0c4712fe760d8969427ef91107e9c062d91;hp=90dfa0df747acb9314b4ed115c2eec0dee1eae0d;hpb=877c357e7511395bc923ec9efc2e8b021a17ed79;p=linux-2.6 diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 90dfa0df74..0114a78b7c 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -13,6 +13,7 @@ #include #include +#include #include "rtc-core.h" static dev_t rtc_devt; @@ -26,8 +27,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file) struct rtc_device, char_dev); const struct rtc_class_ops *ops = rtc->ops; - if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) - return -EBUSY; + lock_kernel(); + if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) { + err = -EBUSY; + goto out; + } file->private_data = rtc; @@ -37,11 +41,13 @@ static int rtc_dev_open(struct inode *inode, struct file *file) rtc->irq_data = 0; spin_unlock_irq(&rtc->irq_lock); - return 0; + goto out; } /* something has gone wrong */ clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); +out: + unlock_kernel(); return err; }