diff mbox series

[net,1/2] virtio_net: rename ret to err

Message ID 20240528075226.94255-2-hengqi@linux.alibaba.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series virtio_net: fix race on control_buf | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 62 this patch: 45
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang fail Errors and warnings before: 36 this patch: 36
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 45 this patch: 45
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Heng Qi May 28, 2024, 7:52 a.m. UTC
The integer variable 'ret', denoting the return code, is mismatched with
the boolean return type of virtnet_send_command_reply(); hence, it is
renamed to 'err'.

The usage of 'ret' is deferred to the next patch.

Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
---
 drivers/net/virtio_net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Hariprasad Kelam May 28, 2024, 8:31 a.m. UTC | #1
> -----Original Message-----
> From: Heng Qi <hengqi@linux.alibaba.com>
> Sent: Tuesday, May 28, 2024 1:22 PM
> To: netdev@vger.kernel.org; virtualization@lists.linux.dev
> Cc: Michael S. Tsirkin <mst@redhat.com>; Jason Wang
> <jasowang@redhat.com>; Xuan Zhuo <xuanzhuo@linux.alibaba.com>;
> Eugenio Pérez <eperezma@redhat.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Jiri Pirko
> <jiri@resnulli.us>; Daniel Jurgens <danielj@nvidia.com>
> Subject: [EXTERNAL] [PATCH net 1/2] virtio_net: rename ret to err
> 
> Prioritize security for external emails: Confirm sender and content safety
> before clicking links or opening attachments
> 
> ----------------------------------------------------------------------
> The integer variable 'ret', denoting the return code, is mismatched with the
> boolean return type of virtnet_send_command_reply(); hence, it is renamed
> to 'err'.
> 
> The usage of 'ret' is deferred to the next patch.
> 
> Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
> ---
>  drivers/net/virtio_net.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index
> 4a802c0ea2cb..6b0512a628e0 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2686,7 +2686,7 @@ static bool virtnet_send_command_reply(struct
> virtnet_info *vi, u8 class, u8 cmd  {
>  	struct scatterlist *sgs[5], hdr, stat;
>  	u32 out_num = 0, tmp, in_num = 0;
> -	int ret;
> +	int err;
> 
>  	/* Caller should know better */
>  	BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ));
> @@ -2710,10 +2710,10 @@ static bool virtnet_send_command_reply(struct
> virtnet_info *vi, u8 class, u8 cmd
>  		sgs[out_num + in_num++] = in;
> 
>  	BUG_ON(out_num + in_num > ARRAY_SIZE(sgs));
> -	ret = virtqueue_add_sgs(vi->cvq, sgs, out_num, in_num, vi,
> GFP_ATOMIC);
> -	if (ret < 0) {
> +	err = virtqueue_add_sgs(vi->cvq, sgs, out_num, in_num, vi,
> GFP_ATOMIC);
> +	if (err < 0) {
>  		dev_warn(&vi->vdev->dev,
> -			 "Failed to add sgs for command vq: %d\n.", ret);
> +			 "Failed to add sgs for command vq: %d\n.", err);
>  		mutex_unlock(&vi->cvq_lock);
>  		return false;
>  	}
> --
> 2.32.0.3.g01195cf9f
> 
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
Jakub Kicinski May 30, 2024, 12:10 a.m. UTC | #2
On Tue, 28 May 2024 15:52:25 +0800 Heng Qi wrote:
> The integer variable 'ret', denoting the return code, is mismatched with
> the boolean return type of virtnet_send_command_reply(); hence, it is
> renamed to 'err'.
> 
> The usage of 'ret' is deferred to the next patch.

That seems a bit much. Can you call the variable in patch 2 "ok"
instead?
Heng Qi May 30, 2024, 3:10 a.m. UTC | #3
On Wed, 29 May 2024 17:10:53 -0700, Jakub Kicinski <kuba@kernel.org> wrote:
> On Tue, 28 May 2024 15:52:25 +0800 Heng Qi wrote:
> > The integer variable 'ret', denoting the return code, is mismatched with
> > the boolean return type of virtnet_send_command_reply(); hence, it is
> > renamed to 'err'.
> > 
> > The usage of 'ret' is deferred to the next patch.
> 
> That seems a bit much. Can you call the variable in patch 2 "ok"
> instead?

Sure.

Thanks.

> -- 
> pw-bot: cr
diff mbox series

Patch

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4a802c0ea2cb..6b0512a628e0 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2686,7 +2686,7 @@  static bool virtnet_send_command_reply(struct virtnet_info *vi, u8 class, u8 cmd
 {
 	struct scatterlist *sgs[5], hdr, stat;
 	u32 out_num = 0, tmp, in_num = 0;
-	int ret;
+	int err;
 
 	/* Caller should know better */
 	BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ));
@@ -2710,10 +2710,10 @@  static bool virtnet_send_command_reply(struct virtnet_info *vi, u8 class, u8 cmd
 		sgs[out_num + in_num++] = in;
 
 	BUG_ON(out_num + in_num > ARRAY_SIZE(sgs));
-	ret = virtqueue_add_sgs(vi->cvq, sgs, out_num, in_num, vi, GFP_ATOMIC);
-	if (ret < 0) {
+	err = virtqueue_add_sgs(vi->cvq, sgs, out_num, in_num, vi, GFP_ATOMIC);
+	if (err < 0) {
 		dev_warn(&vi->vdev->dev,
-			 "Failed to add sgs for command vq: %d\n.", ret);
+			 "Failed to add sgs for command vq: %d\n.", err);
 		mutex_unlock(&vi->cvq_lock);
 		return false;
 	}