diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c index 899891bec352..0572053a7944 100644 --- a/drivers/media/IR/lirc_dev.c +++ b/drivers/media/IR/lirc_dev.c @@ -366,6 +366,11 @@ int lirc_unregister_driver(int minor) } ir = irctls[minor]; + if (!ir) { + printk(KERN_ERR "lirc_dev: lirc_unregister_driver: " + "failed to get irctl struct for minor %d!", minor); + return -ENOENT; + } mutex_lock(&lirc_dev_lock);