Message ID | 20240123184632.725054-2-afd@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-35895-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp541741dyi; Tue, 23 Jan 2024 10:56:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+P63enlYlcTrFJSUSNOAhukuZ1jzhqRs/+O4+rXcGWcrh+p+5c+RGMPs8b/vD45g29oze X-Received: by 2002:a05:6a00:1988:b0:6db:dbb2:ae7c with SMTP id d8-20020a056a00198800b006dbdbb2ae7cmr5315175pfl.35.1706036211865; Tue, 23 Jan 2024 10:56:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706036211; cv=pass; d=google.com; s=arc-20160816; b=D64kdEy+mYw4S0J7F+D3/Ph+LAm0jcxn4QZ2SOepiU4rQuhsvjAWY9Gb5J7oxJpMgA OoeZNr0cCD4owwAeKd63kwNISH+J36R3Pcx7TKfFlioYbSLi+TsP9SH0bfNQEPE0jrVE 3JbcUV9BlQ8tEC0Wr0OGixL1Xkh5GJoRU4uewYof4HG8KfYKZ7oFPsfShUFvMryF7UXE 8uri8NkQRkUHUEA1HdYIeDHywstasVEAcZ9yxbKhdRjLfWxzolvZT9JLgcvYGp/NDAL9 eAJ3NRe07RuJSnLQybvk2744aSuVA++kcqdYBud4TnBLFtwWilJ6d+tcRdX+WWpZa2nb vEtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XULANMiamCh2z47DetgW0gGkmV23v5Hxx2b4xb/xhAE=; fh=rmmMs/JsOUVHi++Wrl5ML8j1LcPsVgqH/ULrQQY0bCs=; b=p+3O7OE9K4oZQ82wKYxbq1nqDtdj5SaVGHPvqu2xj5X2VX8dmt0kCEd1j6VyC2X1Ks bSVtZtYeP3lODutno23R3aLQRmG5avXpGEwBLjdHfb/HOvKKcNLmtvdttKa5Jg3HPfnv HlEdXnW0fRsBV/ohuf0r0DURDi8j15+wHrmABw4HjqnkUu5if0Pvh2vM+ZdSJlsAu/SH 1lp7NA8WSYzyLFj0V5pn4BOv5YrFxniAVbzCRL//qYL+JVuYoPP1cKtMPCv67zChatL8 idb16XEIF1uYQBUkzl1KjbHvGwWqLenmSy7vkc0TqRrqtCVelKkbv9BRvclpOAAHEQFo 50xA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sH6yT3O8; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35895-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35895-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g130-20020a636b88000000b005cecb6a1027si10333355pgc.702.2024.01.23.10.56.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 10:56:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35895-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sH6yT3O8; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35895-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35895-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 771E0290FE2 for <ouuuleilei@gmail.com>; Tue, 23 Jan 2024 18:49:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 802411292C1; Tue, 23 Jan 2024 18:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="sH6yT3O8" Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5A8682D94; Tue, 23 Jan 2024 18:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706035617; cv=none; b=KFqAWinCtC8UAvYykEYGXEbIkfom0ryaDsABkdYguIoGpj4JrHr6xXLetcsXPSfrHpVQS6lHArZu55Kf+JJjdUqeoDj39+t3tFVewwP5QO7xMhMJ/dn0BXUm4IMywIfXc5CXtzSqPFyNUEdZo4bkXKGnJMtCfsNbR8LCFcFNv7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706035617; c=relaxed/simple; bh=m/yWZtNxfkZivwoe0ZZTr4FL+nbuPIxIAAeRJ+811kE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PfJEYdVOVTcuV+3amFkCEkE6DdLG071hrbOGmCtakqh9t4t3hJsfEHExheuCQupkHuswGqDyV2sIIwKfLQCAx9tdzXSL3EXY7bwPyZZVWezL39XJFo2KT4mkijzQot8awQGktxaUk2VPPATA0gOrLDGbZ1iijUafMSutHMUcT+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=sH6yT3O8; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NIkZFm111630; Tue, 23 Jan 2024 12:46:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706035595; bh=XULANMiamCh2z47DetgW0gGkmV23v5Hxx2b4xb/xhAE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=sH6yT3O8jIYfaltHigwZlf2pGTWjqa0M/TADp31nZojUJ8AHg0RYvRuV4h484pH0F 8IHgAMwAqAsjHNauHb25/HAIGBIMsIAHDtaD3Y93n/8xTHTdDBwg2kS0XfHAB9cg7B L2FX2b53D45Yze2B1bzkU3gXuBicFgVxuJgOJuZw= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NIkZnL011008 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 12:46:35 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 23 Jan 2024 12:46:35 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 23 Jan 2024 12:46:35 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40NIkX1r063265; Tue, 23 Jan 2024 12:46:34 -0600 From: Andrew Davis <afd@ti.com> To: Bjorn Andersson <andersson@kernel.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Konrad Dybcio <konrad.dybcio@linaro.org>, Patrice Chotard <patrice.chotard@foss.st.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com> CC: <linux-remoteproc@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, Andrew Davis <afd@ti.com> Subject: [PATCH 2/9] remoteproc: imx_rproc: Use devm_rproc_alloc() helper Date: Tue, 23 Jan 2024 12:46:25 -0600 Message-ID: <20240123184632.725054-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123184632.725054-1-afd@ti.com> References: <20240123184632.725054-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788908627093980606 X-GMAIL-MSGID: 1788908627093980606 |
Series |
[1/9] remoteproc: imx_dsp_rproc: Use devm_rproc_alloc() helper
|
|
Commit Message
Andrew Davis
Jan. 23, 2024, 6:46 p.m. UTC
Use the device lifecycle managed allocation function. This helps prevent
mistakes like freeing out of order in cleanup functions and forgetting to
free on error paths.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/remoteproc/imx_rproc.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
Comments
On 1/23/2024 8:46 PM, Andrew Davis wrote: > Use the device lifecycle managed allocation function. This helps prevent > mistakes like freeing out of order in cleanup functions and forgetting to > free on error paths. > > Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com> Thanks, Iulia > --- > drivers/remoteproc/imx_rproc.c | 16 +++++----------- > 1 file changed, 5 insertions(+), 11 deletions(-) > > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c > index 8bb293b9f327c..55ecce3ab5f75 100644 > --- a/drivers/remoteproc/imx_rproc.c > +++ b/drivers/remoteproc/imx_rproc.c > @@ -1104,16 +1104,14 @@ static int imx_rproc_probe(struct platform_device *pdev) > int ret; > > /* set some other name then imx */ > - rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, > - NULL, sizeof(*priv)); > + rproc = devm_rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, > + NULL, sizeof(*priv)); > if (!rproc) > return -ENOMEM; > > dcfg = of_device_get_match_data(dev); > - if (!dcfg) { > - ret = -EINVAL; > - goto err_put_rproc; > - } > + if (!dcfg) > + return -EINVAL; > > priv = rproc->priv; > priv->rproc = rproc; > @@ -1124,8 +1122,7 @@ static int imx_rproc_probe(struct platform_device *pdev) > priv->workqueue = create_workqueue(dev_name(dev)); > if (!priv->workqueue) { > dev_err(dev, "cannot create workqueue\n"); > - ret = -ENOMEM; > - goto err_put_rproc; > + return -ENOMEM; > } > > ret = imx_rproc_xtr_mbox_init(rproc); > @@ -1167,8 +1164,6 @@ static int imx_rproc_probe(struct platform_device *pdev) > imx_rproc_free_mbox(rproc); > err_put_wkq: > destroy_workqueue(priv->workqueue); > -err_put_rproc: > - rproc_free(rproc); > > return ret; > } > @@ -1183,7 +1178,6 @@ static void imx_rproc_remove(struct platform_device *pdev) > imx_rproc_put_scu(rproc); > imx_rproc_free_mbox(rproc); > destroy_workqueue(priv->workqueue); > - rproc_free(rproc); > } > > static const struct of_device_id imx_rproc_of_match[] = {
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 8bb293b9f327c..55ecce3ab5f75 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -1104,16 +1104,14 @@ static int imx_rproc_probe(struct platform_device *pdev) int ret; /* set some other name then imx */ - rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, - NULL, sizeof(*priv)); + rproc = devm_rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, + NULL, sizeof(*priv)); if (!rproc) return -ENOMEM; dcfg = of_device_get_match_data(dev); - if (!dcfg) { - ret = -EINVAL; - goto err_put_rproc; - } + if (!dcfg) + return -EINVAL; priv = rproc->priv; priv->rproc = rproc; @@ -1124,8 +1122,7 @@ static int imx_rproc_probe(struct platform_device *pdev) priv->workqueue = create_workqueue(dev_name(dev)); if (!priv->workqueue) { dev_err(dev, "cannot create workqueue\n"); - ret = -ENOMEM; - goto err_put_rproc; + return -ENOMEM; } ret = imx_rproc_xtr_mbox_init(rproc); @@ -1167,8 +1164,6 @@ static int imx_rproc_probe(struct platform_device *pdev) imx_rproc_free_mbox(rproc); err_put_wkq: destroy_workqueue(priv->workqueue); -err_put_rproc: - rproc_free(rproc); return ret; } @@ -1183,7 +1178,6 @@ static void imx_rproc_remove(struct platform_device *pdev) imx_rproc_put_scu(rproc); imx_rproc_free_mbox(rproc); destroy_workqueue(priv->workqueue); - rproc_free(rproc); } static const struct of_device_id imx_rproc_of_match[] = {