[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7e12e950-fece-845f-6784-d3e59480f810@acm.org>
Date: Fri, 13 May 2022 19:41:35 -0700
From: Bart Van Assche <bvanassche@....org>
To: Guo Zhengkui <guozhengkui@...o.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Max Gurtovoy <mgurtovoy@...dia.com>,
Mike Christie <michael.christie@...cle.com>,
Varun Prakash <varun@...lsio.com>,
"open list:SCSI TARGET SUBSYSTEM" <linux-scsi@...r.kernel.org>,
"open list:SCSI TARGET SUBSYSTEM" <target-devel@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Cc: zhengkui_guo@...look.com
Subject: Re: [PATCH linux-next] scsi: target: cxgbit: replace ternary operator
with min()
On 5/12/22 06:37, Guo Zhengkui wrote:
> diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
> index 3336d2b78bf7..6d9a13da6cb7 100644
> --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c
> +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
> @@ -1008,7 +1008,7 @@ int cxgbit_ofld_send(struct cxgbit_device *cdev, struct sk_buff *skb)
> ret = cxgb4_ofld_send(cdev->lldi.ports[0], skb);
> if (ret < 0)
> kfree_skb(skb);
> - return ret < 0 ? ret : 0;
> + return min(ret, 0);
> }
>
> static void cxgbit_release_tid(struct cxgbit_device *cdev, u32 tid)
> @@ -1039,7 +1039,7 @@ cxgbit_l2t_send(struct cxgbit_device *cdev, struct sk_buff *skb,
> ret = cxgb4_l2t_send(cdev->lldi.ports[0], skb, l2e);
> if (ret < 0)
> kfree_skb(skb);
> - return ret < 0 ? ret : 0;
> + return min(ret, 0);
> }
>
> static void cxgbit_send_rx_credits(struct cxgbit_sock *csk, struct sk_buff *skb)
I prefer to keep the existing code since "return min(ret, 0)" is not how
humans write kernel code.
Thanks,
Bart.
Powered by blists - more mailing lists