Skip to content

Commit a63b69f

Browse files
Li Haoranmartinkpetersen
authored andcommitted
scsi: scsi_transport_srp: Replace min/max nesting with clamp()
This patch replaces min(a, max(b, c)) by clamp(val, lo, hi) in the SRP transport layer. The clamp() macro explicitly expresses the intent of constraining a value within bounds, improving code readability. Signed-off-by: Li Haoran <li.haoran7@zte.com.cn> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Link: https://lore.kernel.org/r/202503311555115618U8Md16mKpRYOIy2TOmB6@zte.com.cn Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 1fd2e77 commit a63b69f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/scsi_transport_srp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static void srp_reconnect_work(struct work_struct *work)
388388
"reconnect attempt %d failed (%d)\n",
389389
++rport->failed_reconnects, res);
390390
delay = rport->reconnect_delay *
391-
min(100, max(1, rport->failed_reconnects - 10));
391+
clamp(rport->failed_reconnects - 10, 1, 100);
392392
if (delay > 0)
393393
queue_delayed_work(system_long_wq,
394394
&rport->reconnect_work, delay * HZ);

0 commit comments

Comments
 (0)