OSDN Git Service

scsi: sd: Improve sd_print_capacity()
authorDamien Le Moal <damien.lemoal@wdc.com>
Wed, 30 Jan 2019 07:07:34 +0000 (16:07 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 5 Feb 2019 03:07:24 +0000 (22:07 -0500)
commitd7e6db20944c8fb26073bc3ba9d5328992b82858
tree2fcc6f26bb7b30d006713d8129c3b5ee26d0ac9c
parent27752647f88a1b03019e03f21f32b60452af7d4b
scsi: sd: Improve sd_print_capacity()

There is no need to call twice string_get_size() when the capacity messages
are not going to be printed. Reverse the message output condition to return
early and avoid executing string_get_size() when it is not necessary.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c