Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp665290rdb; Tue, 23 Jan 2024 10:47:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWcs4Hg99/pcY52y2wImkktwqz8VI+FI35T4UeI2gH44YOXm2k4jubNaj63y0gMBjeHysV X-Received: by 2002:a17:907:8747:b0:a27:8080:9417 with SMTP id qo7-20020a170907874700b00a2780809417mr104747ejc.17.1706035667490; Tue, 23 Jan 2024 10:47:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706035667; cv=pass; d=google.com; s=arc-20160816; b=nwaI+ze/VXbeTtAVDjDcX7z9+Dj9HfzEhHnV9R4CA3CT/+pA5N7bchuDb7fKwwf57y iqLFDwG9hjED5hdeXVamWpif+nuTzbxWnke4myJEIIUAmM8/5CosfKmivw5GsxrhkQm+ hGyVm2G4jZecC93sQfd8Zr2cLymcrmEdgMvhgK6VdwWnmpQOZJulyEAM66bW4jR2AJga dauAem4nX3vTxQXTsJr34mQbjp6eJJUOxfi/Iw+6dLE5+CyMJofd8RooBPqwDethatpk OAspNOsMJ2oGhwbNEBIg01XwQfSbXFCxKvhdtFW0evgR2Jgii+2OJveMRtHPJYUjWUfz XLlA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=XeeSlUJpmCl1n+FlHrxIzPkq1fOSmy6cPo4580Aj5iQ=; fh=rmmMs/JsOUVHi++Wrl5ML8j1LcPsVgqH/ULrQQY0bCs=; b=ziCCvJ+IU6tCoGvmJkNPBm01hTYZo1VtRx23UembBfKG1Wq8mkVGYmaw9dnnGtB5FE HkZLtPlo+2NFmmqFnvZpp+jlbly8vIv0CJcj4DGjBK/e+grszyaDi2cIW5iAf9TNAuL0 xxQf8x7ylWvFYIQB/+RnsP+qZ7GE0ogYjXLshG/wHSPleWjV+JShncYXpWYmMaRriHtD nT0bWPmR+DD7cjuOBf+Kxpn2MpyWrW7KiQ668ZzypH4/bo21U1FCTGv0fRF3OVSwf0Lm /39UPROsAJf4KuqOmykDPmrnjUbENU7Wt4zRKOAywQhSgxYh4GaGlLxDbatcT29HQawD QcyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=bvrdxdcC; 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-35889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k6-20020a170906128600b00a2a2b08accdsi11660804ejb.420.2024.01.23.10.47.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 10:47:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=bvrdxdcC; 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-35889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35889-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4469A1F21C77 for ; Tue, 23 Jan 2024 18:47:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53F7585C44; Tue, 23 Jan 2024 18:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="bvrdxdcC" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 E9B88823A6; Tue, 23 Jan 2024 18:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706035614; cv=none; b=IbxZXhOH3Cz8EERbOEohmLkryPEEyUjA1B3JUT7L7DvkgOXG2PNWcdbvUSTt19Q2YZFodiY1pFZW4RZ3paJw5QINtEvt4zTO96tXwGl3IZCDP0slMccfyoU4naOlKFMul8/JM6SwU0GXt3tHGY2F7okfCzrZul2GnKci399Swgs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706035614; c=relaxed/simple; bh=oXdcUOHdzcJ0rZcx7lEysvWIJaq+w9yrXFR7q2lxaDM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=VuYkhBHwiEuiTtmeFWnumtacN1k4ZTV03Ahh3mKf6OMa13uzG0iVGzDXB0pbLq5ioAOQbqib1enwhjahbY0D9R/X9oy/lIPkoA7JsEefKl2rBlqGtbtTkXjK/82e/PTzMXaK8S8D0UA+fgCeZAktYcnqwcpxkFLI+sucybdRfNk= 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=bvrdxdcC; arc=none smtp.client-ip=198.47.23.249 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 fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NIkYmI010741; Tue, 23 Jan 2024 12:46:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706035594; bh=XeeSlUJpmCl1n+FlHrxIzPkq1fOSmy6cPo4580Aj5iQ=; h=From:To:CC:Subject:Date; b=bvrdxdcCiJXYod16gkvmswfo7VblMFdDx87z2qrQ11byV8x5YScu/SVaSCygh47+Q NrSsodgXLwZIchC8pLf2qAt2zX1mE7RFMIAS+vrU3syxkruVBhefR1uMEwJuPU7+s/ 01o+LrbYJSkqgbKdmetYu3Y1ISX0RGWQF6YXNBt8= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NIkYfs009810 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 12:46:34 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE112.ent.ti.com (157.170.170.23) 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:34 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE103.ent.ti.com (157.170.170.33) 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:34 -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 40NIkX1q063265; Tue, 23 Jan 2024 12:46:33 -0600 From: Andrew Davis To: 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: , , , , Andrew Davis Subject: [PATCH 1/9] remoteproc: imx_dsp_rproc: Use devm_rproc_alloc() helper Date: Tue, 23 Jan 2024 12:46:24 -0600 Message-ID: <20240123184632.725054-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 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 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 --- 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 */ -- 2.39.2