summaryrefslogtreecommitdiff
path: root/fs/char_dev.c
diff options
context:
space:
mode:
authorSrivatsa S. Bhat <srivatsa@csail.mit.edu>2018-02-06 05:25:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-15 19:59:24 +0300
commitf33ff110ef31bd250bb8a16cfc4e883aa2b36767 (patch)
treef3badb24cc0bfb74515d6ac73d2d74593734121a /fs/char_dev.c
parent652d703b21eb1caf2673c10bd58e4b0121dc7c50 (diff)
downloadlinux-f33ff110ef31bd250bb8a16cfc4e883aa2b36767.tar.xz
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>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r--fs/char_dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 33c938542160..a279c58fe360 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -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;
}