Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1398699rdb; Wed, 24 Jan 2024 14:13:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IET0/zUHw2RpeimcebeKWFEKm24ted/njWXJpNHQPg4myGc8x0YlsqYTDZS6m5RcX3pY29A X-Received: by 2002:a05:6a00:1d0e:b0:6db:d01e:7c53 with SMTP id a14-20020a056a001d0e00b006dbd01e7c53mr183165pfx.52.1706134380294; Wed, 24 Jan 2024 14:13:00 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cz4-20020aa79304000000b006d9b870ddb8si14902946pfb.349.2024.01.24.14.12.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 14:13:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=K9mlkgtU; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-37730-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.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 7480228484B for ; Wed, 24 Jan 2024 22:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 548B7135A4B; Wed, 24 Jan 2024 22:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="K9mlkgtU" Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2066.outbound.protection.outlook.com [40.107.105.66]) (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 D18A9135A41; Wed, 24 Jan 2024 22:11:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.66 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706134318; cv=fail; b=DcFmLsF3jcNkRyRT7GWSIol4egEhEaiIqddcwxuiX8jHObgC/27dI2zEQZhCyG1JnoKGoGl3Y1pE7z4kyzJSKDnmg+GkKqL8XTeFQ28/cMAtNbEDnxl7ux/ZXBPZ3+39wrmF8RcSgaFNe59tKJbcCT+iiH2ww+aAIB6t8JBT2ps= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706134318; c=relaxed/simple; bh=snFMG98KC0TyLNYBPSrJDnDMvVRd9aHEONdzfSxZqUQ=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=FH5UmsU8ky4QZl1YIbtUNWEf8Jb3FXKI/+w97d1WjdBCz5F4hRIXarq+3frMz1iv4pzKEAYHFu2D5jatR9T4b53yNx/LrZbOX52t8VxM3xUBkiJkw94T7l3zYVEbXtDjdCE/dzPWFrOOWJ0DSH3++Pyit71LPMsb2Vc12+/kD5o= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=K9mlkgtU; arc=fail smtp.client-ip=40.107.105.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NgFbKipT3AAOjOllWWOGI6vSJyh/VUeY/6JVFj63oC5Bf+NifPjEIAl15IYrU+zOMSkVaUC61toZBEBDZ8cQIKMcrPKIE2EwpD1H1u85qX9rKV2kOVdU8VtdZpttZTYVTeLRXKiEWPAgRUOzmjVDQXNYK9Vr+VG5HO3NMmc6jc8bqSCDrJjLBV6LkJRbEb+cqRnv5a33YWjcN9wXjsnNw20vvr3K+sQ/ZtjExqI2lb7z31lDBJ2Vg9Iz2W6R3saWVThNwB148bIfUsyUCSOzb83LcV0/4P45KtYxvwwwuRAMMEa/IOrfcmQss7p2WqoTzxyeJIgB+d7I8MiUJcx9PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XmNcg3fyaLuJXWDaHIbNdOOIA6nD0MphUsn5cDnGnQE=; b=ANm9xGZqSjOcPgO6IZoqM49zWLPXL0CWbkgj5n9iY/4c8+UwoY3ObaswQb2uJG54gHIM6hlovdU2hhJAeUzMVM1+DkvHBuxqrzzUORye13SObGg6obdX3n71pDjMtVZhm41pYbeq3CnUQgv2RLm5qFJYqVQmQqC/334uxOGXu6SfWRFTCQrEIC7vIwIJhlmVzhwtgToCg2bF0icxkm5fRgWGHrBfpbSLnpq16yd5c+8zcF0/nGKeARciiuNChRF8YXmAC7BlW5x0UVy4Gt43Jne81JSGX2v7biwZ4uoEJdBL3W9nFAC2DZ/Hul3SzJ4uwuUh4WCu50WCkPR3xlLgQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XmNcg3fyaLuJXWDaHIbNdOOIA6nD0MphUsn5cDnGnQE=; b=K9mlkgtU7fC1F0LcrdZ5IEpJSEWrqujH+TGbHtF3DCRgbZdEQXrP1I2bXPRs0x407iKi3XQzS9BoHE4aEUA5QU+1Hl7kY3ijy51f8P/Ow/wkZqf4gJCf5++3QmpKFbzuNfa1wB+AMtaJLIsW0ItVVJJW6fnyN6GAJLC69Y4J/xw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8774.eurprd04.prod.outlook.com (2603:10a6:10:2e1::21) by DU2PR04MB8631.eurprd04.prod.outlook.com (2603:10a6:10:2de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.26; Wed, 24 Jan 2024 22:11:50 +0000 Received: from DU2PR04MB8774.eurprd04.prod.outlook.com ([fe80::f2fa:645a:969:6743]) by DU2PR04MB8774.eurprd04.prod.outlook.com ([fe80::f2fa:645a:969:6743%5]) with mapi id 15.20.7228.022; Wed, 24 Jan 2024 22:11:50 +0000 Message-ID: <04ea2835-518a-4829-b70a-66043c3acf0e@nxp.com> Date: Thu, 25 Jan 2024 00:11:47 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/9] remoteproc: imx_dsp_rproc: Use devm_rproc_alloc() helper To: Andrew Davis , Bjorn Andersson , Mathieu Poirier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Konrad Dybcio , Patrice Chotard , Maxime Coquelin , Alexandre Torgue Cc: linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20240123184632.725054-1-afd@ti.com> Content-Language: en-US From: Iuliana Prodan In-Reply-To: <20240123184632.725054-1-afd@ti.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS4P191CA0015.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::12) To DU2PR04MB8774.eurprd04.prod.outlook.com (2603:10a6:10:2e1::21) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8774:EE_|DU2PR04MB8631:EE_ X-MS-Office365-Filtering-Correlation-Id: cfcac9d7-fbd1-48b3-7909-08dc1d2976c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v3wxjInrRxVX29UDtcOweR2LFd2QS43DXbgVH367qu6NUPAZVRIOJIx8F8arzkSOU4VYGF1e+47XtYSmjbYhDxUdofWjwmR4z18kJXtsCKzEVPH0dUO7x27mUt/JiCYFOl5hU2xV1G1P6MtOfu6CzU7qxwx/2TkdAz6LXNmkjIqDfOcC5ad0CcFGbc9cPCb1z1YhaXBONaNmuG4ZtVJjxaYQY6nEDI7CHKeTL4pTOndRKloUlozZP4ln+1eCNMS8CMN2r1K7WAze0jwoFV2RulTvbbofVmrdD3+m55CuLBGsrK3uq32Ya8ojsNhkHZ+ThcMSbVZ3sFxUBeLXTuf2iIt+iibNGO7eO/CA6hIYCG/T2ulZS5dt8F/I+fRi97ibavEKOIiSfSz2LXD4HhIOJPbcZyR/Ai+gRzMxdHcRtQqUJUl8xvZqDMwKTjS2DrbOOn9wgCj5B0kIvdUCZsihAPxwU4JGnbIpuCDh7wrUNIk6Z7DAkM8HUJtMIE48AcWBwRp6fMSNUMbuI2x9odCcz+nGQen1fJ664VnPJsRKFs+QrtDs4MFBhNTAS1BtQ4S7aSX8gZ1Ql8Tr8OasF9r0Zk0HZL1YxDUWiCmtmZoYSoDAu+ijjWpjTlvaYs3k/QNEJHvHdRU5SO4E27j0ENxhb7PSpHvr8HT/IF4pjpap3x8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8774.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(136003)(346002)(396003)(366004)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(8676002)(8936002)(4326008)(44832011)(2906002)(7416002)(5660300002)(31696002)(86362001)(110136005)(66556008)(66946007)(66476007)(316002)(36756003)(6486002)(38100700002)(6506007)(53546011)(6512007)(478600001)(6666004)(83380400001)(26005)(2616005)(41300700001)(921011)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L21FQXhPbzMzeVhUTXJqelBFdTk1U0RkYzdFTXVzWlBmQ1kreHdocmFNQ3JZ?= =?utf-8?B?dVo4YkIzaGRXaGJGZ0FGaWdlS29ORm8zOS8wNWR3Z3BMa3NqSnF3Q3h4ZHJR?= =?utf-8?B?WlVJN0ZqeVF6c2hqYXFDU3I0RTVQSzh5aVN0UjFkQk9NQ1ZDWTR6M2tZMmJY?= =?utf-8?B?bDZDTS80eW4vVTZJSEg3ZFZQVmQ0QU9FSW1pNTN6QXoxQlRJMTlWdTUwdHRJ?= =?utf-8?B?OEY2RzFpZ0ZmSGdGQ092QnhQcmErWWlJcHEyL3VJTUxYcHN3eUpNdENMNGlk?= =?utf-8?B?M3pVRE8ybkZmRDM0TkVvTkRkV0lYRG9jWWFxZGFJdGlNSVFqYytkbWh1VmpK?= =?utf-8?B?YWo2V1JaUERZcno3TUJwcVozd3BlamM4bGE4OGFZQjFpdG5hcWdsUTF5YUdv?= =?utf-8?B?ZU5MeHFVeVpDTXpLMWdQK0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: cfcac9d7-fbd1-48b3-7909-08dc1d2976c1 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8774.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2024 22:11:50.7653 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nPYkPXfJCj91ExEzXKwP02TKIWeufd7STbZPOKZxSsBd8mhE/b4PtBNMWYMEcMQ8FQqq9HHRM0LAjD3cwFv0rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8631 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 Reviewed-by: Iuliana Prodan Thanks, Iulia > --- > drivers/remoteproc/imx_dsp_rproc.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c > index a1c62d15f16c6..56a799cb8b363 100644 > --- a/drivers/remoteproc/imx_dsp_rproc.c > +++ b/drivers/remoteproc/imx_dsp_rproc.c > @@ -1104,8 +1104,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) > return ret; > } > > - rproc = rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops, fw_name, > - sizeof(*priv)); > + rproc = devm_rproc_alloc(dev, "imx-dsp-rproc", &imx_dsp_rproc_ops, > + fw_name, sizeof(*priv)); > if (!rproc) > return -ENOMEM; > > @@ -1125,14 +1125,14 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) > ret = imx_dsp_rproc_detect_mode(priv); > if (ret) { > dev_err(dev, "failed on imx_dsp_rproc_detect_mode\n"); > - goto err_put_rproc; > + return ret; > } > > /* There are multiple power domains required by DSP on some platform */ > ret = imx_dsp_attach_pm_domains(priv); > if (ret) { > dev_err(dev, "failed on imx_dsp_attach_pm_domains\n"); > - goto err_put_rproc; > + return ret; > } > /* Get clocks */ > ret = imx_dsp_rproc_clk_get(priv); > @@ -1155,8 +1155,6 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev) > > err_detach_domains: > imx_dsp_detach_pm_domains(priv); > -err_put_rproc: > - rproc_free(rproc); > > return ret; > } > @@ -1169,7 +1167,6 @@ static void imx_dsp_rproc_remove(struct platform_device *pdev) > pm_runtime_disable(&pdev->dev); > rproc_del(rproc); > imx_dsp_detach_pm_domains(priv); > - rproc_free(rproc); > } > > /* pm runtime functions */