On Fri, Apr 25, 2008 at 11:55:25PM +0530, anubhav rakshit wrote: > Signed-off-by: Anubhav Rakshit <anubhavrocks@xxxxxxxxx> > --- > fs/char_dev.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/fs/char_dev.c b/fs/char_dev.c > index 038674a..f4c371a 100644 > --- a/fs/char_dev.c > +++ b/fs/char_dev.c > @@ -199,7 +199,10 @@ int register_chrdev_region(dev_t from, unsigned > count, const char *name) > struct char_device_struct *cd; > dev_t to = from + count; > dev_t n, next; > - > + > + if(unlikely(count == 0)) > + return -EINVAL; > + > for (n = from; n < to; n = next) { > next = MKDEV(MAJOR(n)+1, 0); > if (next > to) I'd say a) unlikely in such rarely used function is useless b) register_chrdev_region(from, 0, name); unregister_chrdev_region(from, 0); will unregister region sucessfully ;-) c) this is problem of a caller -- don't! -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html