Skip to content

Commit ca945e7

Browse files
NeilBrowntorvalds
authored andcommitted
memstick: don't allocate unused major for ms_block
When alloc_disk(0) is used the ->major number is completely ignored. All devices are allocated with a major of BLOCK_EXT_MAJOR. So remove registration and deregistration of 'major'. Link: http://lkml.kernel.org/r/20160602064318.4403.49955.stgit@noble Signed-off-by: NeilBrown <[email protected]> Cc: Keith Busch <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Maxim Levitsky <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent bc083a6 commit ca945e7

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

drivers/memstick/core/ms_block.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,31 +2338,18 @@ static struct memstick_driver msb_driver = {
23382338
.resume = msb_resume
23392339
};
23402340

2341-
static int major;
2342-
23432341
static int __init msb_init(void)
23442342
{
2345-
int rc = register_blkdev(0, DRIVER_NAME);
2346-
2347-
if (rc < 0) {
2348-
pr_err("failed to register major (error %d)\n", rc);
2349-
return rc;
2350-
}
2351-
2352-
major = rc;
2353-
rc = memstick_register_driver(&msb_driver);
2354-
if (rc) {
2355-
unregister_blkdev(major, DRIVER_NAME);
2343+
int rc = memstick_register_driver(&msb_driver);
2344+
if (rc)
23562345
pr_err("failed to register memstick driver (error %d)\n", rc);
2357-
}
23582346

23592347
return rc;
23602348
}
23612349

23622350
static void __exit msb_exit(void)
23632351
{
23642352
memstick_unregister_driver(&msb_driver);
2365-
unregister_blkdev(major, DRIVER_NAME);
23662353
idr_destroy(&msb_disk_idr);
23672354
}
23682355

0 commit comments

Comments
 (0)