Skip to content

Commit 30363d6

Browse files
Chengguang Xuaxboe
authored andcommitted
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>
1 parent dd95749 commit 30363d6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/m68k/emu/nfblock.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,22 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
155155
static int __init nfhd_init(void)
156156
{
157157
u32 blocks, bsize;
158+
int ret;
158159
int i;
159160

160161
nfhd_id = nf_get_id("XHDI");
161162
if (!nfhd_id)
162163
return -ENODEV;
163164

164-
major_num = register_blkdev(major_num, "nfhd");
165-
if (major_num <= 0) {
165+
ret = register_blkdev(major_num, "nfhd");
166+
if (ret < 0) {
166167
pr_warn("nfhd: unable to get major number\n");
167-
return major_num;
168+
return ret;
168169
}
169170

171+
if (!major_num)
172+
major_num = ret;
173+
170174
for (i = NFHD_DEV_OFFSET; i < 24; i++) {
171175
if (nfhd_get_capacity(i, 0, &blocks, &bsize))
172176
continue;

0 commit comments

Comments
 (0)