mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
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>
This commit is contained in:
parent
dd957493ba
commit
30363d6506
1 changed files with 7 additions and 3 deletions
|
@ -155,18 +155,22 @@ out:
|
||||||
static int __init nfhd_init(void)
|
static int __init nfhd_init(void)
|
||||||
{
|
{
|
||||||
u32 blocks, bsize;
|
u32 blocks, bsize;
|
||||||
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
nfhd_id = nf_get_id("XHDI");
|
nfhd_id = nf_get_id("XHDI");
|
||||||
if (!nfhd_id)
|
if (!nfhd_id)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
major_num = register_blkdev(major_num, "nfhd");
|
ret = register_blkdev(major_num, "nfhd");
|
||||||
if (major_num <= 0) {
|
if (ret < 0) {
|
||||||
pr_warn("nfhd: unable to get major number\n");
|
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++) {
|
for (i = NFHD_DEV_OFFSET; i < 24; i++) {
|
||||||
if (nfhd_get_capacity(i, 0, &blocks, &bsize))
|
if (nfhd_get_capacity(i, 0, &blocks, &bsize))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue