Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2574223rdb; Mon, 5 Feb 2024 10:32:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFM/g+asJ0XMqDeplXIoH+J04ezATFMqFaIpBJ51emFW+qjKwqXN305ibwmqB1AEUu0H3WV X-Received: by 2002:aa7:87cf:0:b0:6e0:4196:da11 with SMTP id i15-20020aa787cf000000b006e04196da11mr388482pfo.14.1707157970330; Mon, 05 Feb 2024 10:32:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707157970; cv=pass; d=google.com; s=arc-20160816; b=bsg5/f9KqxMmTfiHI0B9qQyO18Gg21XisvE750NM+YlsRR6Kxgmhi2g2YH5GLoDnBQ 1ofJ5U4dVIsbnR/+/guL3XPjwOktaL3Q8nmXgShQls4UbB+20Xev6LyEnVbnPamqgVlA 0ytZnlWp9Z/9so1+ln1o+7WvSv0YO55SmYMK1D+/jBJK2lhAoCEEO78lfMjK8fDRY9jp mSHXt//tLrtU/b7YU5Kkm5rXpRfUPiWtGeY4KCWQAEMoe20xrpmAOzDw232IcS1hJahh SEJBT/Qk15FtPDCWHBs/OvjtfcvAOGkJG9dNMB8wA9ysryk+R9rPzW3xbeVD1Ug7dF3Y a3pw== 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=cCOdsqhr20y5QKXtiSnCUsddUxH/Yci+gnu7HPlrDyE=; fh=0M99gKQ7OKvmlZBDkmmxbVT4sge+c/JbFhdiW2WYpnU=; b=yr2+jGRJXENukrH5wfxL98LjkWGDbbkffE9tr/dXVN93sFT3LPCHoiAzrevq3sdY3/ ihIcWWj/lXeVGMa/5iaxgmIQt21krSpGSnd6ZIWXFSqxA8ujg0skISj+cpua7I/ivffo dvmrhPEBIZx0Os8fHFyg9Tg+Z8Q+xHiNLJABWGh09udgSfeSkWYSVTaAGUQOuLh43GDm Zll3gBvDG1gzL0hWuTCFviNZjRLG/P5WDCzdFqOYgFNXPoZR3prLTmUkRtECKOPhmTbw kQVGhGucyHhcseG1s4H22H27zAHUofjmsA78TDu1OW7memYap8dKVKVDigYId97NDd6B K2bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=H5yulMLP; 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-53217-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53217-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=1; AJvYcCUNatxoF5QgqzJo5D/humgITLofOs96DWvtE0h9Wgisawj2PXfoQJO7MsIdES+cNY3YtRLZl/D7Gzd6Qf7VbGZ8/Tz+/qGfj98Pmmm8Vw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id le6-20020a056a004fc600b006e02feedca9si191115pfb.27.2024.02.05.10.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 10:32:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53217-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=H5yulMLP; 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-53217-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53217-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 31F9FB2273A for ; Mon, 5 Feb 2024 18:29:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78A97495E0; Mon, 5 Feb 2024 18:28:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="H5yulMLP" 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 13682482FE; Mon, 5 Feb 2024 18:27:59 +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=1707157681; cv=none; b=CMLTFqTpSA7uAXFeFOFogZMcpwe3AZeGFO3/a0K5VWaCNe8ALaJc6ioNbSPOA3EQwN4OgT/KCWolIOZ17lwP++Dln14pH/WppEuxJUWKLiOCMn2q9C76SBnGr2OGADIi4qis2pw2AsKX+EfC/YRj0m1gYHj1v9A7Wiw4bRC+Vys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707157681; c=relaxed/simple; bh=UTKjnl02zRrNFWyX0e1HTEuHJnpztcqmM5wI4qOg/PM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tFUndIcuFAkuNbQfnGbY5McoCbRvhUwLc8PYcsX1xsQUQHNaDzmKOQ5shWsE1P3befB3qGpiwNd/+pf+B4FS6Fmx7lJmMyW8s2epKxmWJ9SiEICOWz/wPcHmdivyTZU7IaruQIRRJ6/s48xajmEiX0LBbfn9aLB7Gl2QjCyadVk= 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=H5yulMLP; 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 lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 415IRukq120265; Mon, 5 Feb 2024 12:27:56 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707157676; bh=cCOdsqhr20y5QKXtiSnCUsddUxH/Yci+gnu7HPlrDyE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=H5yulMLPBSMo1WqQqmzdeIODB5B+tM/DEG72QsvlnQ+3FHxzoHYJKwp3pNlHNljjt Hqu+0vCM+6BicpapV4dsQYmr+5Sd3/cRR98hdiMWfo6aD9ydfNHx+e1C4wImrWKPVb sh1nsOdLszLKhwFsN6aorpx9ERxOTxrEhCTYM0jQ= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 415IRu8B123163 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Feb 2024 12:27:56 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 5 Feb 2024 12:27:56 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE106.ent.ti.com (10.64.6.27) 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; Mon, 5 Feb 2024 12:27:56 -0600 Received: from lelvsmtp6.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 415IRsX9058567; Mon, 5 Feb 2024 12:27:55 -0600 From: Andrew Davis To: Jai Luthra , Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH v2 5/5] remoteproc: k3-dsp: Use devm_rproc_add() helper Date: Mon, 5 Feb 2024 12:27:53 -0600 Message-ID: <20240205182753.36978-6-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205182753.36978-1-afd@ti.com> References: <20240205182753.36978-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use device lifecycle managed devm_rproc_add() helper function. This helps prevent mistakes like deleting out of order in cleanup functions and forgetting to delete on all error paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c index f799f74734b4a..3555b535b1683 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -768,7 +768,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev) } } - ret = rproc_add(rproc); + ret = devm_rproc_add(dev, rproc); if (ret) return dev_err_probe(dev, ret, "failed to add register device with remoteproc core\n"); @@ -786,14 +786,9 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev) if (rproc->state == RPROC_ATTACHED) { ret = rproc_detach(rproc); - if (ret) { - /* Note this error path leaks resources */ + if (ret) dev_err(dev, "failed to detach proc (%pe)\n", ERR_PTR(ret)); - return; - } } - - rproc_del(kproc->rproc); } static const struct k3_dsp_mem_data c66_mems[] = { -- 2.39.2