Skip to content

Commit bcfe9b6

Browse files
rddunlapaxboe
authored andcommitted
virtio_blk: eliminate anonymous module_init & module_exit
Eliminate anonymous module_init() and module_exit(), which can lead to confusion or ambiguity when reading System.map, crashes/oops/bugs, or an initcall_debug log. Give each of these init and exit functions unique driver-specific names to eliminate the anonymous names. Example 1: (System.map) ffffffff832fc78c t init ffffffff832fc79e t init ffffffff832fc8f8 t init Example 2: (initcall_debug log) calling init+0x0/0x12 @ 1 initcall init+0x0/0x12 returned 0 after 15 usecs calling init+0x0/0x60 @ 1 initcall init+0x0/0x60 returned 0 after 2 usecs calling init+0x0/0x9a @ 1 initcall init+0x0/0x9a returned 0 after 74 usecs Fixes: e467cde ("Block driver using virtio.") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: virtualization@lists.linux-foundation.org Cc: Jens Axboe <axboe@kernel.dk> Cc: linux-block@vger.kernel.org Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20220316192010.19001-2-rdunlap@infradead.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 85d9abc commit bcfe9b6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/block/virtio_blk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ static struct virtio_driver virtio_blk = {
10221022
#endif
10231023
};
10241024

1025-
static int __init init(void)
1025+
static int __init virtio_blk_init(void)
10261026
{
10271027
int error;
10281028

@@ -1048,14 +1048,14 @@ static int __init init(void)
10481048
return error;
10491049
}
10501050

1051-
static void __exit fini(void)
1051+
static void __exit virtio_blk_fini(void)
10521052
{
10531053
unregister_virtio_driver(&virtio_blk);
10541054
unregister_blkdev(major, "virtblk");
10551055
destroy_workqueue(virtblk_wq);
10561056
}
1057-
module_init(init);
1058-
module_exit(fini);
1057+
module_init(virtio_blk_init);
1058+
module_exit(virtio_blk_fini);
10591059

10601060
MODULE_DEVICE_TABLE(virtio, id_table);
10611061
MODULE_DESCRIPTION("Virtio block driver");

0 commit comments

Comments
 (0)