summaryrefslogtreecommitdiff
path: root/arch/m68k/emu
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2019-02-01 06:26:02 +0300
committerJens Axboe <axboe@kernel.dk>2019-02-06 22:50:40 +0300
commit30363d6506d0d202bb14f4dac36d9b4b0714ad8d (patch)
tree601ac4b8cc6050515e9602a2e8d7c42a85826eb2 /arch/m68k/emu
parentdd957493baa586f1431490f97f9c7c45eaf8ab10 (diff)
downloadlinux-30363d6506d0d202bb14f4dac36d9b4b0714ad8d.tar.xz
m68k: set proper major_num when specifying module param major_num
When calling register_blkdev() with specified major device number, the return code is 0 on success. So it seems not correct direct assign return code to variable major_num in this case. Tested-by: Michael Schmitz <schmitzmic@gmail.com> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'arch/m68k/emu')
-rw-r--r--arch/m68k/emu/nfblock.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index 38049357d6d3..40712e49381b 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -155,18 +155,22 @@ out:
static int __init nfhd_init(void)
{
u32 blocks, bsize;
+ int ret;
int i;
nfhd_id = nf_get_id("XHDI");
if (!nfhd_id)
return -ENODEV;
- major_num = register_blkdev(major_num, "nfhd");
- if (major_num <= 0) {
+ ret = register_blkdev(major_num, "nfhd");
+ if (ret < 0) {
pr_warn("nfhd: unable to get major number\n");
- return major_num;
+ return ret;
}
+ if (!major_num)
+ major_num = ret;
+
for (i = NFHD_DEV_OFFSET; i < 24; i++) {
if (nfhd_get_capacity(i, 0, &blocks, &bsize))
continue;