X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Ftelephony%2Fphonedev.c;h=4d74ba36c3a12b0d8acd19cd7115b154522f862b;hb=9465efc9e96135a2cec8154c0c766fa59984a298;hp=4d8c2a5b3297fdb2447f764ac8f5974277d936fd;hpb=ef29498655b18d2bfd69048e20835d19333981ab;p=linux-2.6-omap-h63xx.git diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index 4d8c2a5b329..4d74ba36c3a 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,7 @@ static int phone_open(struct inode *inode, struct file *file) if (minor >= PHONE_NUM_DEVICES) return -ENODEV; + lock_kernel(); mutex_lock(&phone_lock); p = phone_device[minor]; if (p) @@ -79,6 +81,7 @@ static int phone_open(struct inode *inode, struct file *file) fops_put(old_fops); end: mutex_unlock(&phone_lock); + unlock_kernel(); return err; } @@ -120,9 +123,8 @@ int phone_register_device(struct phone_device *p, int unit) void phone_unregister_device(struct phone_device *pfd) { mutex_lock(&phone_lock); - if (phone_device[pfd->minor] != pfd) - panic("phone: bad unregister"); - phone_device[pfd->minor] = NULL; + if (likely(phone_device[pfd->minor] == pfd)) + phone_device[pfd->minor] = NULL; mutex_unlock(&phone_lock); }