Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3989956pxf; Tue, 16 Mar 2021 03:01:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8kzXx5xxnY2WADOrjCwy5PrZKmx1XUG9OLBAVbGwGI/zQZpRRmJqA1vp+P4Vx5vN9rRJR X-Received: by 2002:aa7:c1d0:: with SMTP id d16mr34596938edp.153.1615888876829; Tue, 16 Mar 2021 03:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615888876; cv=none; d=google.com; s=arc-20160816; b=AQRFkQGlAVH9Oezb1BnO4pqDmRX1ytXe2t1fMdwPVsTLL3fNcByCoP4ZPKZAcyPJdl bpQH4apDM5X1C9owKXvHmJ0hvk5JzizflVrKRKhDfJ0BHrZJtB2ZKCHII2FDiTPoF22S J4/guMZm18VPnbZtkEqJt8mRcIpw1xOyIed1YOiLOOTa5eXtLT2/SsWBFed7xLHe20Z2 VmJjSxzBldTXWLXU25eAKZ9eAsgnywnqr8PBsEPghlHJr+ZTooFCxW8u4yzrHAxVAzQb GTvyR+P5qJK+wN5Yu85FW0vj0HK/AoMjTuIQ9lHjmyt4E4bJ09+tNzuV5nuOVXofdhud fRcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=f4wDCsbXH4YETe98HxKm64cvWck1J8s5Dvrag+7DKjA=; b=T0Ox3srpiwS/7//oGB80K47BjFd4hAPtmIoKSzg/yJxNoeDtM+gKjXkAE2CXx/KrpT 75oQ5PHG9pUhTGJtutXonwMFwqlRnIutzSomJspdP7DAUfH0yixIBoQNkxqrtJ1z+5AR fGsOiwVnM+J9GMABfAOQiJ3kP6p4YK8Re58KcO32UOeK8D9fQJ6KeAPp6P56VdXMPBe3 ywk8qUaaPufN2fWfoegXbNYaym8fh20iLCBoWFuLVUmEGzCL5k9EtdLSvOHnraYuhwBX 7ISNqsBJMzcXe1PfhEW2/ahRt08c2Idf4io7qp0rUfA/z7CUZhbVuy6fCgpNxOX0ko1L cL8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=E0kJUM+7; 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=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si13449651eja.163.2021.03.16.03.00.52; Tue, 16 Mar 2021 03:01:16 -0700 (PDT) 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=@marvell.com header.s=pfpt0220 header.b=E0kJUM+7; 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=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236226AbhCPJ1x (ORCPT + 99 others); Tue, 16 Mar 2021 05:27:53 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:2820 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233002AbhCPJ1c (ORCPT ); Tue, 16 Mar 2021 05:27:32 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12G9QRwd020155; Tue, 16 Mar 2021 02:27:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=f4wDCsbXH4YETe98HxKm64cvWck1J8s5Dvrag+7DKjA=; b=E0kJUM+74L3ty01+7izuBXkpS3QocxvR2BLVC4WNkrrMirrFilw3KDW54llMx3k6emwk +ShixQvkwFQ0PpNcv/JHF8XV/WWQblrJyFIGw32C4vz/xMzLTok+4rt0NGmj15b0zJrF Xfla6z+chjcL/8sjoox58CTsBcy3Zla99yFVj3OAkTISNbbCyxthV+dpfNV+2e86wd9u UGQIUPrFwZMqljllkq04uzRan+UWLT27XOyJoqWj7Z7nhU48Bkk485Ne23iyq12LtupX MUT/dbz2pSDaZsFzlCzF4qaGE8dg9HkusKm9oVVbO+2No9MMeaiYJ0/0fVOExy9fLSz9 IQ== Received: from dc6wp-exch01.marvell.com ([4.21.29.232]) by mx0a-0016f401.pphosted.com with ESMTP id 378umtfrbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 16 Mar 2021 02:27:30 -0700 Received: from DC6WP-EXCH01.marvell.com (10.76.176.21) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Mar 2021 05:27:28 -0400 Received: from maili.marvell.com (10.76.176.51) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 16 Mar 2021 05:27:28 -0400 Received: from hyd1soter2.marvell.com (unknown [10.29.37.45]) by maili.marvell.com (Postfix) with ESMTP id 09EB33F7040; Tue, 16 Mar 2021 02:27:24 -0700 (PDT) From: Hariprasad Kelam To: , CC: , , , , , , , Subject: [net PATCH 3/9] octeontx2-af: Do not allocate memory for devlink private Date: Tue, 16 Mar 2021 14:57:07 +0530 Message-ID: <1615886833-71688-4-git-send-email-hkelam@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615886833-71688-1-git-send-email-hkelam@marvell.com> References: <1615886833-71688-1-git-send-email-hkelam@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-16_03:2021-03-15,2021-03-16 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Subbaraya Sundeep Memory for driver private structure rvu_devlink is also allocated during devlink_alloc. Hence use the allocated memory by devlink_alloc and access it by devlink_priv call. Fixes: fae06da4("octeontx2-af: Add devlink suppoort to af driver") Signed-off-by: Subbaraya Sundeep Signed-off-by: Hariprasad Kelam Signed-off-by: Sunil Kovvuri Goutham --- drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c index 10a98bc..d88ac90 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c @@ -1380,14 +1380,9 @@ int rvu_register_dl(struct rvu *rvu) struct devlink *dl; int err; - rvu_dl = kzalloc(sizeof(*rvu_dl), GFP_KERNEL); - if (!rvu_dl) - return -ENOMEM; - dl = devlink_alloc(&rvu_devlink_ops, sizeof(struct rvu_devlink)); if (!dl) { dev_warn(rvu->dev, "devlink_alloc failed\n"); - kfree(rvu_dl); return -ENOMEM; } @@ -1395,10 +1390,10 @@ int rvu_register_dl(struct rvu *rvu) if (err) { dev_err(rvu->dev, "devlink register failed with error %d\n", err); devlink_free(dl); - kfree(rvu_dl); return err; } + rvu_dl = devlink_priv(dl); rvu_dl->dl = dl; rvu_dl->rvu = rvu; rvu->rvu_dl = rvu_dl; -- 2.7.4