From patchwork Mon Feb 5 18:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 196987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1062667dyb; Mon, 5 Feb 2024 10:30:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdLCTX4jPB9L/wC0Q3zSo3vlG+WPTr9xmM/rGf6BZnV8YOnb1cIBc8DauMxjmjn0rl7TiD X-Received: by 2002:a17:906:7c4d:b0:a23:7633:59ae with SMTP id g13-20020a1709067c4d00b00a23763359aemr464234ejp.9.1707157834431; Mon, 05 Feb 2024 10:30:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707157834; cv=pass; d=google.com; s=arc-20160816; b=pN8TV8Lut/takX6n5fsuae/54ysH1xsoAwZ921W0al/5AtaVqBcROhn9mnhOLzUZy+ 4Bodrz4/fTJQSRYrCt53gAL51+qPXRfs9lkotvQuEEUNYlSsH0LuAgZ/B45PgidvJvzJ iekt3wbmhD7jq+A1K/Kmq6gdEz2/mmpzj4Pi+joxhAk1TmRjv9kYoBZjaWg9dkERzbqs nTsxKOT768QPv8aZLtKvkJRsns4CaiRLj2C8/CrE4VWInDQcYBYrRcl9A5ZhwRq1+z1i lcZSKJQqd6vluabmr7GZBoRgyu/nJSN8ScU4oVW4CUr7KFM0VbrXLhznztvdVA4MF9W8 P6PQ== 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=g1q4FekfzRMSbOBtJtjziYmh6/fEDmEyxKNCwbQkyVA=; fh=sxcI/PvGLfTJoA+LaB6L2p4pM3ofYBQuNyJWO+nguaE=; b=DQRIoY/nUKHU19i12Qdm6P6QbZfxFJecO6asmisAx45yGHyVPIe9Otq6lVAKPTzsup zJnl0hYi0NeBgwGnzOf6XmWpo3h1B5kSiKvnZ6WB1KKUDOUf6ns5uaYjWmuhPi73EiUJ lKq4lm2spt8wpvwMZ9gMdDglDgjcLnnRtIN3gBG5Ou0KgYdWYAHGjNZ5CBOqCge4/79o wah9VjTVfK2d8wC70o6oOJfZwgDL6Kl/s2Wruo6Z8IZlxrT81gj+4PMe+0GihSab8+63 2q6YUQLcXYQv6C8NN5Y2V1lxI64qP0IaUy306dRYzQ9cGEX3IgvzNjWUTbvNgHtzWxNz PmPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pwPX+TFq; 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-53216-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53216-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=1; AJvYcCV8oeoI4VsCD/lr1axEZ5tMQvLTz6gF+yksce+7nbwUZYZ4eDcibIJI1lvRgCUHjukkgDKnEtYXaVuACokJXWyBWPsGgg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v11-20020a1709064e8b00b00a35cf772d4asi103092eju.323.2024.02.05.10.30.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 10:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53216-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pwPX+TFq; 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-53216-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53216-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0FA0C1F239AB for ; Mon, 5 Feb 2024 18:30:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 645174DA0D; Mon, 5 Feb 2024 18:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="pwPX+TFq" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 DD62A482EC; Mon, 5 Feb 2024 18:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707157681; cv=none; b=oHz/ujxCjEzudUqO2vkXov//YFMz+3Cs2lysT4EIYhi/CHzMgM3AIqdE3MFSVr4vl8RY2j2ju77YOE77JnGjI3xbXQaGCe1TaZIlmAqaiaDwN2WwpN9EKWtLUMsBcM3AyT2yekyDfXBmf7jkzqntaHSHnc8ZUoa9YRA0kIaQHWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707157681; c=relaxed/simple; bh=BZRn5HxmV1kTcaDGI1DqUA2GdRQp+wL20o190NF3od0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Om5SwrGsuA5ja+zxT5srhiciBT4F4vb3h6B9tdLrFfIB5nK7ZlZelssEIYt2kL5shtg/h0uFyOJS+7ZivV7yZ40uvRpFscttPMUkrD3HaJzuxbsBpo61/AJZfjwa74G6JOpr8eQJ0xCVlwu63Zje7LdA9yJVzv0l9XMtLYF2w7o= 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=pwPX+TFq; arc=none smtp.client-ip=198.47.19.142 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 fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 415IRtY3004117; Mon, 5 Feb 2024 12:27:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707157675; bh=g1q4FekfzRMSbOBtJtjziYmh6/fEDmEyxKNCwbQkyVA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pwPX+TFqEibVAR0LKRl4aBT/N7JSyGxWWcF51fOkcpb1oczyj0iJQHqL06f6ERqId AFg0TBSY7vAmasMXGQoMq+xBYKb/K1/ChF3XH003f/E0Spp+/CRNNWhCEetrvwfeUI nNl+/tyH6hSHFjV27iNMFlj2xLIWhEhKHgdUqphY= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 415IRt4I017727 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Feb 2024 12:27:55 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE108.ent.ti.com (157.170.170.38) 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:55 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE104.ent.ti.com (157.170.170.34) 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:55 -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 415IRsX6058567; Mon, 5 Feb 2024 12:27:54 -0600 From: Andrew Davis To: Jai Luthra , Hari Nagalla , Bjorn Andersson , Mathieu Poirier CC: , , Andrew Davis Subject: [PATCH v2 2/5] remoteproc: k3-dsp: Use devm_kzalloc() helper Date: Mon, 5 Feb 2024 12:27:50 -0600 Message-ID: <20240205182753.36978-3-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 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790084733213060237 X-GMAIL-MSGID: 1790084733213060237 Use device lifecycle managed devm_kzalloc() helper function. This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on all error paths. Signed-off-by: Andrew Davis --- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c index 64ec5759c4ec1..b9332c66a52ab 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -659,7 +659,7 @@ struct ti_sci_proc *k3_dsp_rproc_of_get_tsp(struct device *dev, if (ret < 0) return ERR_PTR(ret); - tsp = kzalloc(sizeof(*tsp), GFP_KERNEL); + tsp = devm_kzalloc(dev, sizeof(*tsp), GFP_KERNEL); if (!tsp) return ERR_PTR(-ENOMEM); @@ -730,7 +730,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev) ret = ti_sci_proc_request(kproc->tsp); if (ret < 0) { dev_err_probe(dev, ret, "ti_sci_proc_request failed\n"); - goto free_tsp; + return ret; } ret = k3_dsp_rproc_of_get_memories(pdev, kproc); @@ -797,8 +797,6 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev) ret1 = ti_sci_proc_release(kproc->tsp); if (ret1) dev_err(dev, "failed to release proc (%pe)\n", ERR_PTR(ret1)); -free_tsp: - kfree(kproc->tsp); return ret; } @@ -824,8 +822,6 @@ static void k3_dsp_rproc_remove(struct platform_device *pdev) if (ret) dev_err(dev, "failed to release proc (%pe)\n", ERR_PTR(ret)); - kfree(kproc->tsp); - k3_dsp_reserved_mem_exit(kproc); }