From fa785f0a984d863a24d2f288b68757188a50261b Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 26 Nov 2015 20:22:50 +0200 Subject: [PATCH] scsi_debug: check for bigger value first Even for signed types we have to check for bigger positive value first. Otherwise it will be never happened. Signed-off-by: Andy Shevchenko Acked-by: Douglas Gilbert Reviewed-by: Johannes Thumshirn Reviewed-by: Ewan Milne Signed-off-by: Martin K. Petersen --- drivers/scsi/scsi_debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index ec622ba9864a..1bea1adc16a8 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -4846,10 +4846,10 @@ static int __init scsi_debug_init(void) /* play around with geometry, don't waste too much on track 0 */ sdebug_heads = 8; sdebug_sectors_per = 32; - if (scsi_debug_dev_size_mb >= 16) - sdebug_heads = 32; - else if (scsi_debug_dev_size_mb >= 256) + if (scsi_debug_dev_size_mb >= 256) sdebug_heads = 64; + else if (scsi_debug_dev_size_mb >= 16) + sdebug_heads = 32; sdebug_cylinders_per = (unsigned long)sdebug_capacity / (sdebug_sectors_per * sdebug_heads); if (sdebug_cylinders_per >= 1024) { -- GitLab