diff mbox series

[2/2] scsi: megaraid_sas: Use max helper for comparison and assignment

Message ID bf5884a7bd7c1c92497664eb793c99051b81d67a.1674900575.git.drv@mailo.com
State New
Headers show
Series scsi: megaraid/megaraid_sas: Use max helper for comparison and assignment | expand

Commit Message

Deepak R Varma Jan. 28, 2023, 10:39 a.m. UTC
Simplify code using max() helper macro for logical evaluation and value
assignment.
Proposed change is identified using minmax.cocci semantic patch script.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 7fa472ab0b94..4ca9b04e1962 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5993,10 +5993,7 @@  megasas_alloc_irq_vectors(struct megasas_instance *instance)
 			instance->msix_vectors - instance->iopoll_q_count,
 			i, instance->iopoll_q_count);
 
-	if (i > 0)
-		instance->msix_vectors = i;
-	else
-		instance->msix_vectors = 0;
+	instance->msix_vectors = max(i, 0);
 
 	if (instance->smp_affinity_enable)
 		megasas_set_high_iops_queue_affinity_and_hint(instance);