Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp432256lqp; Mon, 10 Jun 2024 08:22:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9xGRNVyW2vZ44R26spLPbS1uwYhQsFqXv6ldW36SRbWKHlKD1ekGPrKyVlrX+r1te/C+H+Ylj7CpZQF4F9YT8YLTwYZ7+fI1m4ZefDg== X-Google-Smtp-Source: AGHT+IEWhWJCtqLjXuaVHpMJcRGWPqRPBbnQb4xff9I0eVYkTDOYhngBGJtuTPk+jQLh08o2DyHC X-Received: by 2002:a25:fe10:0:b0:dfb:61e:3ee0 with SMTP id 3f1490d57ef6-dfb061e416emr7075362276.10.1718032942388; Mon, 10 Jun 2024 08:22:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718032942; cv=pass; d=google.com; s=arc-20160816; b=kcdWCNaqxp79xVTfkbgFysZ3dAU89ggEkwjl4mv0SybbIXiSZmqUNJs9ahNjwrUjHS JbHSnWM/IUIQoECQnYU2aEXUNbQxtzbL+lhZeWKTo0rH/rqm1YQNoGLTtgX8AI04hdVA ChaF+3GesS22Cva6wEqvELT7Y6pSPPU/+O5XeWNaKNvxsxXVqk/euC3R21sHrwQkjRa9 gzb2ifjVsZ78Ik5u00AOA07JHcSccDxGaPCfyjIwYfr+UmhNEOKxVdUh6CfL88U7X/Ri fy4t75bPrJANxjffk9VoPMvhUU7iGnLu8AIPVvD5aS40UucZX9VG20p5Fn7ma3I/xW0M 8zCA== 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=UytDmNmxyZC8MU+aqCgHNCsUlOhqj7U+hI6dXupZkKo=; fh=7gyyxKLdNxw/+wLX/xbi71mpuxCiOZFN8x453bmxIcE=; b=YEUpmuBM5WTwTb4iZQdcEmE64jiaoQo2o04CUEOHRIICigzDJ3HBNjphwnAEwmLWbk aALELi+x34ENrYAFDAo5DajzQfk9xoByZ4k7PDIKR5GWZwo4FG0+gh/FxiWwjGETWloQ XxTzTloOuBNTUXiIZq1G4F5ilJlS5b8p7gY2VtnktK43t4V3bvWddgFlM8dZEolrr5ox nqN1PSj+YvUIP2EQa0jsBRYfiXd0GMUQOzmq/ZdgHH9ERYHpYq7krtGxus5Moy4efdgo Wo0rfHIFu0iLbDCxEfiqT+JNMse55PACX1BDHPkKz/q5U5dTkEarcuXVSCQDuVVeW3wr HSJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cHpSipvY; 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-208462-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b04f99ce13si77191946d6.357.2024.06.10.08.22.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 08:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208462-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cHpSipvY; 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-208462-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208462-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 101C61C238EC for ; Mon, 10 Jun 2024 15:22:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7CD51527B4; Mon, 10 Jun 2024 15:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="cHpSipvY" 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 83D1813E8AF; Mon, 10 Jun 2024 15:17:28 +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=1718032651; cv=none; b=P6SqSd2fsFyUrN3oYIM7zwyYWfUXcvWrCqV/9rk+b0TYUecR3cMycuGQUZ86M9NP1u9fJtKGj88Sa+j8/0Z6mB0H+LX42UvEGmJXjYrqqEmwbQ6gST5il2ou5maOEAB7Po4bltML2VOozzSAju//D8MheRde6TR2j7HE/fXXdbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718032651; c=relaxed/simple; bh=JAyHEY+j18HTYSYl1Aztg6T0nMyvI/Xbze+2yOXq6bQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CHq7IeHB0XtUDZ/RpcZWJtNHfascvp0B3/iyTQmt685yuuOvk9s4i1p2ZHcnr4zsjrGhzkvi4eVnTcxNLujZTV03yqduUwbRVE39wj+BJ9it1HOEaTSoooPbPXkQ/QTFOcgXIJfJfYdGbBEHEQAc1b6Hb16USOJa3dsvwZ5kTSI= 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=cHpSipvY; 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 45AFHOZc031194; Mon, 10 Jun 2024 10:17:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1718032644; bh=UytDmNmxyZC8MU+aqCgHNCsUlOhqj7U+hI6dXupZkKo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cHpSipvYBMjdnsJn7DCQFrE9iK1sO6RP8bBJI35DJpZuYwIYFyFf+v1xMJbsA0/9k ETkc2CJfKkZtIKHTLJikjEWo+NIU3ZTKTQeKqx0O7VDm+D8Eu6TgLjISzFtrrlOnh7 sr8qZxvYCHMomreV/2GJfCP0OoPVcOW+hoRg2KHM= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 45AFHOId017909 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2024 10:17:24 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 10 Jun 2024 10:17:23 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE107.ent.ti.com (10.64.6.28) 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, 10 Jun 2024 10:17:23 -0500 Received: from fllvsmtp7.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 45AFHMqe017714; Mon, 10 Jun 2024 10:17:23 -0500 From: Andrew Davis To: Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH 4/6] remoteproc: da8xx: Use devm_rproc_alloc() helper Date: Mon, 10 Jun 2024 10:17:19 -0500 Message-ID: <20240610151721.189472-4-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240610151721.189472-1-afd@ti.com> References: <20240610151721.189472-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 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/da8xx_remoteproc.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 9041a0e07fb25..c8b7576937733 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -295,8 +295,8 @@ static int da8xx_rproc_probe(struct platform_device *pdev) } } - rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name, - sizeof(*drproc)); + rproc = devm_rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name, + sizeof(*drproc)); if (!rproc) { ret = -ENOMEM; goto free_mem; @@ -313,7 +313,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) ret = da8xx_rproc_get_internal_memories(pdev, drproc); if (ret) - goto free_rproc; + goto free_mem; platform_set_drvdata(pdev, rproc); @@ -323,7 +323,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) rproc); if (ret) { dev_err(dev, "devm_request_threaded_irq error: %d\n", ret); - goto free_rproc; + goto free_mem; } /* @@ -333,7 +333,7 @@ static int da8xx_rproc_probe(struct platform_device *pdev) */ ret = reset_control_assert(dsp_reset); if (ret) - goto free_rproc; + goto free_mem; drproc->chipsig = chipsig; drproc->bootreg = bootreg; @@ -344,13 +344,11 @@ static int da8xx_rproc_probe(struct platform_device *pdev) ret = rproc_add(rproc); if (ret) { dev_err(dev, "rproc_add failed: %d\n", ret); - goto free_rproc; + goto free_mem; } return 0; -free_rproc: - rproc_free(rproc); free_mem: if (dev->of_node) of_reserved_mem_device_release(dev); @@ -371,7 +369,6 @@ static void da8xx_rproc_remove(struct platform_device *pdev) disable_irq(drproc->irq); rproc_del(rproc); - rproc_free(rproc); if (dev->of_node) of_reserved_mem_device_release(dev); } -- 2.39.2