diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 5396beec30d0ca62b3d97a0c73c0ac66cb8ceccc..1cb61a761cb284cc6dd590e6ebd8062f6271d246 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -94,7 +94,9 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, kfree(rtc); exit_idr: + mutex_lock(&idr_lock); idr_remove(&rtc_idr, id); + mutex_unlock(&idr_lock); exit: dev_err(dev, "rtc core: unable to register %s, err = %d\n",