block, char_dev: Use correct format specifier for unsigned ints
register_blkdev() and __register_chrdev_region() treat the major number as an unsigned int. So print it the same way to avoid absurd error statements such as: "... major requested (-1) is greater than the maximum (511) ..." (and also fix off-by-one bugs in the error prints). While at it, also update the comment describing register_blkdev(). Signed-off-by: Srivatsa S. Bhat <srivatsa@csail.mit.edu> Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
652d703b21
commit
f33ff110ef
+2
-2
@@ -121,8 +121,8 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
|
||||
}
|
||||
|
||||
if (major >= CHRDEV_MAJOR_MAX) {
|
||||
pr_err("CHRDEV \"%s\" major requested (%d) is greater than the maximum (%d)\n",
|
||||
name, major, CHRDEV_MAJOR_MAX);
|
||||
pr_err("CHRDEV \"%s\" major requested (%u) is greater than the maximum (%u)\n",
|
||||
name, major, CHRDEV_MAJOR_MAX-1);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user