linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eli Cohen <elic@nvidia.com>
To: <trix@redhat.com>
Cc: <mst@redhat.com>, <jasowang@redhat.com>, <parav@nvidia.com>,
	<si-wei.liu@oracle.com>, <xieyongji@bytedance.com>,
	<virtualization@lists.linux-foundation.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vdpa/mlx5: simplfy error handler in mlx5_vdpa_dev_add()
Date: Sun, 9 Jan 2022 16:12:07 +0200	[thread overview]
Message-ID: <20220109141207.GC70879@mtl-vdi-166.wap.labs.mlnx> (raw)
In-Reply-To: <20220109132422.4047425-1-trix@redhat.com>

On Sun, Jan 09, 2022 at 05:24:22AM -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> The use of pfmdev is protected by two calls to is_zero_ether_add().
> The second call in the error handler can be replaced by
> checking if pfmdev was set as part of the earlier call.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---

It's not fixing anything, right? Maybe add justification for this change
by e.g. showing the code size had decreased or so?

>  drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 37220f6db7ad7..2d38b8fe9305e 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -2530,7 +2530,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
>  {
>  	struct mlx5_vdpa_mgmtdev *mgtdev = container_of(v_mdev, struct mlx5_vdpa_mgmtdev, mgtdev);
>  	struct virtio_net_config *config;
> -	struct mlx5_core_dev *pfmdev;
> +	struct mlx5_core_dev *pfmdev = NULL;
>  	struct mlx5_vdpa_dev *mvdev;
>  	struct mlx5_vdpa_net *ndev;
>  	struct mlx5_core_dev *mdev;
> @@ -2654,7 +2654,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
>  err_res:
>  	mlx5_vdpa_free_resources(&ndev->mvdev);
>  err_mpfs:
> -	if (!is_zero_ether_addr(config->mac))
> +	if (pfmdev)
>  		mlx5_mpfs_del_mac(pfmdev, config->mac);
>  err_mtu:
>  	mutex_destroy(&ndev->reslock);
> -- 
> 2.26.3
> 

  reply	other threads:[~2022-01-09 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09 13:24 [PATCH] vdpa/mlx5: simplfy error handler in mlx5_vdpa_dev_add() trix
2022-01-09 14:12 ` Eli Cohen [this message]
2022-01-09 17:02   ` Tom Rix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220109141207.GC70879@mtl-vdi-166.wap.labs.mlnx \
    --to=elic@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=si-wei.liu@oracle.com \
    --cc=trix@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).