Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5481102pxb; Mon, 15 Feb 2021 22:39:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoCp3dUaf4/pMO3Wt+g1tElbsKuwL8Dy0tNhwBYLrZ3f6Qf/Zr5szPgX0Sbis2qZnvBAZP X-Received: by 2002:a05:6402:2547:: with SMTP id l7mr18856209edb.157.1613457595000; Mon, 15 Feb 2021 22:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613457594; cv=none; d=google.com; s=arc-20160816; b=Yhwvm9TgpHWQSd7Qc6AA+hgXGEowDozP6rnOIV+Diy/O7IE4ANE3KHFrzZPv3EnpPZ Clyt2RLS0VssAdhCl5/XoUbGx/ByaukKjgLJEjPHZjVfRAqgmvOOl7crh2sDhDlyPT6V KhgjBOpVpsIFQuFTg195xtoXYZ+3f6ayZUDaf7IE0Egio6zJR8o/+I8wtwP0K0mQfbws Ilo5wLej/B6wtxR7KpcCsNVXyEOfy730kS3aNHuShAif0plV4D2tqp2MnPYZUzevs9Kt Nd5YAvfvBXx/KvQiSopZAXqSbaI5kl004NUMx8yt0R4RnTK2mTmj3bY4r32l9jVAZHoz OEcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5ybT2ZUnaX0c0V752GIfbG/xaqr/hBJXu8gkVJhj68E=; b=wyJspZcqcROjt31LdXP2BvMWVnLzDLn1kdLj3fWG7oRvL6c70IP37FiF5uJouaDyjM Moau1xPRUPopL3Zk/Ulk6QkXrpP84c/F9TxSlrdmZL2f2ChB8H5y4e0x7CEAXFPBXNNM 4UccdqIyJsQT7QCuXMWRoYf8sluG4XbZ4kd6yEVIC6lmA9LS6/+duPo/bIFfFTEX7Yh5 Ped7Y59rEejEw+MavA4wrxdTYjr4SP+qat4SnUE0qbieUUghDC6uTHQeQachl0MVvfhy IEkD4yfh74gy/P3GbDCX/c9O9x1T+HrByvVQz18zIoT2L+jeX/ufEsFHQgIZcHD11k4d Crwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Q9cM3sN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si15037868edp.516.2021.02.15.22.39.32; Mon, 15 Feb 2021 22:39:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Q9cM3sN/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229946AbhBPGgl (ORCPT + 99 others); Tue, 16 Feb 2021 01:36:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:52266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbhBPGgg (ORCPT ); Tue, 16 Feb 2021 01:36:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9DB364DDA; Tue, 16 Feb 2021 06:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613457355; bh=JyrtpZs3nYiCe3lUIYAVThOqh4wJbPYr0RlJDjeDkjg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q9cM3sN/iw/E5UBd3Lweuiw84wvHuanw14mFpmpS3uEqH26cfZex5oqlNDHIjOzY5 CJ4KgCLsiTEyBhsfZ+yVuHfEdg0og1hs+mMdi/9t+J+DQUlS9KE5rffSlsIWRg3HCM MwBHk5Dhqa0iRODR76SCh+McfkLEEgQZASSslTbODH6ec9Lwb9DKFNPLHFT6Wl7hMk U2VuN9kd536E78U+Mld2RIxtK2wFjTx/EzPE3BMVcmEcuNiH5eDX5UVJNeprXGe5YT tLj8rmYjRTJ3BMWCMCQSdlgIp+MZ3K1uaI/mRwPF4kME+6Am2TCyjhk+65oEbrzGoe GuXFYO9V0WT6A== Date: Tue, 16 Feb 2021 08:35:51 +0200 From: Leon Romanovsky To: Eli Cohen Cc: mst@redhat.com, jasowang@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, si-wei.liu@oracle.com Subject: Re: [PATCH] vdpa/mlx5: Extract correct pointer from driver data Message-ID: References: <20210216055022.25248-1-elic@nvidia.com> <20210216055022.25248-2-elic@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210216055022.25248-2-elic@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2021 at 07:50:22AM +0200, Eli Cohen wrote: > struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well > in mlx5v_remove(). > > Fixes: 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus") > Signed-off-by: Eli Cohen > --- > 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 6b0a42183622..4103d3b64a2a 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev, > > static void mlx5v_remove(struct auxiliary_device *adev) > { > - struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev); > + struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev); > > - vdpa_unregister_device(&mvdev->vdev); > + vdpa_unregister_device(&ndev->mvdev.vdev); > } IMHO, The more correct solution is to fix dev_set_drvdata() call, because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev". diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 88dde3455bfd..079b8fe669af 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1995,7 +1995,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, if (err) goto err_reg; - dev_set_drvdata(&adev->dev, ndev); + dev_set_drvdata(&adev->dev, mvdev); return 0; err_reg: > > static const struct auxiliary_device_id mlx5v_id_table[] = { > -- > 2.29.2 >