From: Andy Shevchenko Date: Thu, 26 Nov 2015 18:22:50 +0000 (+0200) Subject: scsi_debug: check for bigger value first X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa785f0a984d863a24d2f288b68757188a50261b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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) {