From patchwork Mon Mar 20 22:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 13181969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64267C7619A for ; Mon, 20 Mar 2023 22:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v+Ah08+9GVczHsit7JrND165uG5J9SYm2B8LZd9ly8s=; b=L+tD/d/hNx5+n2 CMiGCe3c+a2GKklabzmhnn9fEztXWTIWx86MZbZbApWfvwTTDf4OnVZkCcMdP8/FrNb2IMhR/t6J5 osJVxG+YZIyMUzO4Sk8XatclfXd2FY0FQUYGSvaqunSXopFdFf1z5xmrhXL7J8wyVISv9rMAahrZi wlY3XFaFlSN5tVeGuc+qVQgJXUHdHnNzxzLCRNGCkUv5qgWcMZN9kNEPX9ngVSs3zcxsGr+VvGmy+ PgHuIMMB8WTZHt4owr42R1x4v/muqr3PHQy2VHqdG1TCVrQ20P2684kvUWMdP7Gk047QiAkXFS7sH lXGLpbjcUXWyNKo5vlwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peNq2-00Ad9I-2p; Mon, 20 Mar 2023 22:18:47 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peNpo-00AcxO-0l for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 22:18:35 +0000 Received: by mail-pj1-x102e.google.com with SMTP id om3-20020a17090b3a8300b0023efab0e3bfso17987510pjb.3 for ; Mon, 20 Mar 2023 15:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679350710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mPLmB3dzpBczm3qRE9s2V0X3S8uJO7/jVxWe+sb20rE=; b=VZXByqS8gHum2nUGLIN3iOP/iDUJ34c9r8a9Mm2c8bP2DU0bJMcb4l7vWherdXtZqv 0Cx81BbLUunRRC50uVwkKjqcMCSvjwdPd+RQS3f5uNZQyFnwIV0zlT6f+M6/wqDAK4KE ZMq7MpX3CmWy/wW+7GZX3KR9NR2L9AG2XPpLcQ+0wfTLDchs92oD9mMmkumxD4Ktdzuh qiQRxVpo0tCBPTugl+oMPgO1IqmdhmZK4WpYVQqIEvGtTAyuc8QGoi61qMxwSKJPFKvf pq6iD/fs8VR9NYw6pbSR95vfLcju1ljWtDCYvl6rfd5tSTSxTZwp4pIB0UFbRv+622U8 m4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679350710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mPLmB3dzpBczm3qRE9s2V0X3S8uJO7/jVxWe+sb20rE=; b=GzhQcUjn90GghCPI2zac0hQLC/2xCYj69EVQ6bGY05u55gsJSYa0nrS+M5aw7dEMjY 0r+AFwcXF55D2NrE8k0fEVph3m+pey/0O5Bwsx8PqS/wdPxe7EzWoRWN6VxVNyRhtmiU tVUfdJGad9ZUtI2PuIDRfunA4HQg8TDmyzpoGeR62U1ooac43KOf51ufW3LstPnFWbz4 y1vPlRprwclBLVxIqsrpngOfInPe8svZGUfr12u/wI9phMV62lW2CZ8V1a3O5DmpZMn/ PTLXQbXU2+jjY6hrfeAf+GaS+UTY5z76TDwFdSvVzXyjuqxSRWtu61UsylDh2ErBQB6x Nzsg== X-Gm-Message-State: AO0yUKXtJAMXWW7sWZNbmsyiqP6r8+xlCJ75m0Y3BZcAOvf2V7NphbQ7 djjYn9sTarYyssS3sM08CznSVg== X-Google-Smtp-Source: AK7set92de8kBYqLx5A0esQubvPjq2QNtxaJtiRr9ydQgC4/m0jxePjCzHFFNlbQqB9Lw07ypdHMsg== X-Received: by 2002:a05:6a20:4f1f:b0:c2:fb92:3029 with SMTP id gi31-20020a056a204f1f00b000c2fb923029mr35523pzb.33.1679350710546; Mon, 20 Mar 2023 15:18:30 -0700 (PDT) Received: from p14s.cg.shawcable.net ([2604:3d09:148c:c800:4ab5:5131:bafc:4428]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm4459196pff.189.2023.03.20.15.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 15:18:30 -0700 (PDT) From: Mathieu Poirier To: andersson@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, patrice.chotard@foss.st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, arnaud.pouliquen@st.com, hongxing.zhu@nxp.com, peng.fan@nxp.com, shengjiu.wang@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] remoteproc: stm32: Call of_node_put() on iteration error Date: Mon, 20 Mar 2023 16:18:22 -0600 Message-Id: <20230320221826.2728078-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320221826.2728078-1-mathieu.poirier@linaro.org> References: <20230320221826.2728078-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230320_151832_303371_D4F1AD5F X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: 13140de09cc2 ("remoteproc: stm32: add an ST stm32_rproc driver") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier reviewed-by: Arnaud Pouliquen --- drivers/remoteproc/stm32_rproc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 7d782ed9e589..23c1690b8d73 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -223,11 +223,13 @@ static int stm32_rproc_prepare(struct rproc *rproc) while (of_phandle_iterator_next(&it) == 0) { rmem = of_reserved_mem_lookup(it.node); if (!rmem) { + of_node_put(it.node); dev_err(dev, "unable to acquire memory-region\n"); return -EINVAL; } if (stm32_rproc_pa_to_da(rproc, rmem->base, &da) < 0) { + of_node_put(it.node); dev_err(dev, "memory region not valid %pa\n", &rmem->base); return -EINVAL; @@ -254,8 +256,10 @@ static int stm32_rproc_prepare(struct rproc *rproc) it.node->name); } - if (!mem) + if (!mem) { + of_node_put(it.node); return -ENOMEM; + } rproc_add_carveout(rproc, mem); index++; From patchwork Mon Mar 20 22:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 13181970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5732CC6FD1D for ; Mon, 20 Mar 2023 22:19:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U93wNjrBkQGEZ8EpTkgCAOLhIBhpkBJu5MsYiOzG73Y=; b=KQnU7GJB+4k+oy XtVhr1p+bni2mVhB1x+nk2kxzvQA64fhb1W9ozgmX4l+9QCiaguKBXrw/+aUJ5qgkaAOG1CWzHVAO OyrkBHnVBO7Tz+FpB0Wvpu4xwJFt/U0FLWaPKAqwKiLhWu5QsSbERsA7lvrkphBTsmIJkEHhONmc1 C3EG/70KVnewpYsW4znTijpAxRXK1KgHQqPl5qrIAX8EJ9WRKb1v70AGVMmRF4mjBLsAMa69MMAGl x8ZuRyPnVMZxS0zRDCKcDLVDKuMQNw/bSC5YYm3hDDQxvg1tQwZRdtO+Mi5AebtMNda6VGvC1BUi6 AgjtD0ck/F8TOIVhl7eA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peNq6-00AdBe-28; Mon, 20 Mar 2023 22:18:50 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peNpp-00Acyk-3B for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 22:18:38 +0000 Received: by mail-pf1-x42f.google.com with SMTP id fb38so2973368pfb.7 for ; Mon, 20 Mar 2023 15:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679350712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lFdP+n8hU6K/nm3EJ5X3exiUwV1teDwsbi7RZq6Ti4k=; b=mKWIQ1ued3KEIaaBhwWod6mpPzfwB+wmMWyZoPsGGBMeDOGU7TYzTm2o3cJ9dnwAv/ H9jxCA8OWqVyyYcl7cNSERbaSFiEFFfkCV1+RQoO0RJvzpf5q+5YzEjgMUopmX1iOPzX qAVeRnj6/xRg/tbaW6zpvDe7UqWeBIaOZYNCqw+rCytUeuLzYCPbVGL60OEXvmUNOwZb GY7ePqkHVmh3woTxGbb7effv4zNLlp7OA1fy43QmdhgDI8lhZqZGh+tcUJnCGBg066d9 YjDKm+OMB90mEFr0Kyhj55ciUpTOFSbSoclC063Lw4ZNDDP7qRLOH3ZYTuyxGkxtpOhE FGRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679350712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lFdP+n8hU6K/nm3EJ5X3exiUwV1teDwsbi7RZq6Ti4k=; b=6L//uxx5mVlorP8LdULLE3sYsdoFWrHsKFsl3BRD9H0K6zlTBgdK06YkrGf+Cm87fy 39bOD5I9b96bR2QqPhBa9wWtGBDwRq3JrQLK7dwK3XwyWqgYQV0mVbsCmxxHVt21uGkE K6K+pbMrrsp2Q4nkiju2QGry9m8nWvYddBt2iHDw/ynb5bU5XAwXdFLwkdTMobxBpJRn p8tB/+inSvHQ7rQg/7DBE9c2LxgtGVRmqF0bpLJPMNnclBmH318QC4pda5X6lOtjBjcv yCd88XRQ1kfFvPytV+UMCE8kZky5IWdxGKonjPloRtH3FOJ8LPQIJRc3EQ79JDQufmiU 0rJw== X-Gm-Message-State: AO0yUKW3d5NtSbSFSBBIsivH06QOOOSNAivW4obu+8bvZQMi43o1cQD2 IpnrBrV7Makj4j9vQbBnL8/Dkw== X-Google-Smtp-Source: AK7set/MHng4ARlnTcxmx0ng1ZTOghx6afNW4lDFSbwHaS2XdaezdegyKPn0y+K3PxUIqlhmhyc4+Q== X-Received: by 2002:aa7:9539:0:b0:627:e69c:8488 with SMTP id c25-20020aa79539000000b00627e69c8488mr340538pfp.14.1679350712244; Mon, 20 Mar 2023 15:18:32 -0700 (PDT) Received: from p14s.cg.shawcable.net ([2604:3d09:148c:c800:4ab5:5131:bafc:4428]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm4459196pff.189.2023.03.20.15.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 15:18:31 -0700 (PDT) From: Mathieu Poirier To: andersson@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, patrice.chotard@foss.st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, arnaud.pouliquen@st.com, hongxing.zhu@nxp.com, peng.fan@nxp.com, shengjiu.wang@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] remoteproc: st: Call of_node_put() on iteration error Date: Mon, 20 Mar 2023 16:18:23 -0600 Message-Id: <20230320221826.2728078-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320221826.2728078-1-mathieu.poirier@linaro.org> References: <20230320221826.2728078-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230320_151834_041250_6FED6644 X-CRM114-Status: GOOD ( 12.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: 3df52ed7f269 ("remoteproc: st: add reserved memory support") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier reviewed-by: Arnaud Pouliquen --- drivers/remoteproc/st_remoteproc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c index a3268d95a50e..e6bd3c7a950a 100644 --- a/drivers/remoteproc/st_remoteproc.c +++ b/drivers/remoteproc/st_remoteproc.c @@ -129,6 +129,7 @@ static int st_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) while (of_phandle_iterator_next(&it) == 0) { rmem = of_reserved_mem_lookup(it.node); if (!rmem) { + of_node_put(it.node); dev_err(dev, "unable to acquire memory-region\n"); return -EINVAL; } @@ -150,8 +151,10 @@ static int st_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) it.node->name); } - if (!mem) + if (!mem) { + of_node_put(it.node); return -ENOMEM; + } rproc_add_carveout(rproc, mem); index++; From patchwork Mon Mar 20 22:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 13181971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA346C6FD1C for ; Mon, 20 Mar 2023 22:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qZxZ/vze9G5nm68hpsiO2aN6gmiISWIXxnw4O+WvRPM=; b=NkbMHGVY2RZBBK qba0mhKtf2IJnfVK7eH2s7zZFtVlbLvm6g0PwxF7eEjtBkR95u+bN2ZUiY4rzvPBXfsarGYABa1yA P6mu49IYenERJTW6olWlTVe+D9j1GEojrqBfxLY5sbuFLX8T4rsKnvPuaN2LUpAkb1JHlJaLMdqLN H2DUokD9AmjVIA0bBIBQzdkFUOcdp+LCk5IzEDAVt17uO5C9x0Wdx406qfyGr+QOqHLiZG/mtIdDu LEHbicJLKJ64yWnWrtFsqilWbt2jyl2JYEfQ0PeYLHu817fQUIo0ei1o0svekoC+Yh9BCEmrXuLYx 6FLSfki01IudizgsdanA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peNqB-00AdEr-16; Mon, 20 Mar 2023 22:18:55 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peNpr-00Ad0e-08 for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 22:18:41 +0000 Received: by mail-pf1-x434.google.com with SMTP id n20so3273755pfa.3 for ; Mon, 20 Mar 2023 15:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679350714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7SvawGG1lzE2m2LYlYl0Sje5AT1/P8cyqdj5Tvo8pXw=; b=PvsJCIxu/xbvlnlhZcbf+hp2aL49LnhKhuTqbalsm2KYp8FtnY4tziFYeq6PECIzcv 7wi6KhU0/ObSDhiFpGp54opvLN9aTw9Wxivakpea5e66Hp5jxFO8z+vOmDN3Y7UHzaR4 e8Zqc9Dn4od77y53Ps62VFI3Fqiz+C08ZRcMRPROfAa6acetGE+EqDK7pMA1L8lJsPE0 fLoMHZufOKtY2UmiwA4oBVPyFh20qPih0+Trtn9bP3JI3L/v4pvBKGd6iINDctJAwTdt 2wGNlFYVcKYBKwuhOu7maadGhWXFYBS9hWhBMXS9gXFGIq16h8VrJ3kYtrTXyx5cZtsD 6sYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679350714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7SvawGG1lzE2m2LYlYl0Sje5AT1/P8cyqdj5Tvo8pXw=; b=WsFfYdJh75+Jv56nBWdVPv3PTSMERgMdHDo3Bj/E0ysaNbozv/7jXwJ8rrBxfmDEEn sbpV5yg9iHzIFmRze7hTvbZJ8Qy9T+kWJnaGjo/EsbQJdJhC6kP/Gzze/v7XNjMgoJG0 ilttjSDOhARYtAJ3QKWTbrkPX1VYzo85ibZs+hLNV0ptonUHpWTQZtpAXT/DlVNP63rO U2Z3GfRXQ3iPqXdeKPbBn+lJODp4hjznxCY6RBWU8as9liWFPfkICta9jIBk3AW2Bam1 XDl7RSnEZPgsvQ52XCfmMOHPL0uD6qrnKW3Fx6EGa+O4A4mY/WiprW4TBuDnnqfOLr3e zm0Q== X-Gm-Message-State: AO0yUKUA/POx6tO5DIwwzIddE/Z3MpHtn8LW4Zj7KHHVqcd9Qxi3guas BhF/WQCSBT1Nq5hFUpxpl1WMxw== X-Google-Smtp-Source: AK7set91Y4YlRhjokRSS2Ws2BcWMaU/uCFjWar6nqsAqx2gZeqmqUwzvD0MsckqftgI7PPc4q9yzpA== X-Received: by 2002:aa7:8614:0:b0:626:22e5:beb8 with SMTP id p20-20020aa78614000000b0062622e5beb8mr11549651pfn.3.1679350713845; Mon, 20 Mar 2023 15:18:33 -0700 (PDT) Received: from p14s.cg.shawcable.net ([2604:3d09:148c:c800:4ab5:5131:bafc:4428]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm4459196pff.189.2023.03.20.15.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 15:18:33 -0700 (PDT) From: Mathieu Poirier To: andersson@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, patrice.chotard@foss.st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, arnaud.pouliquen@st.com, hongxing.zhu@nxp.com, peng.fan@nxp.com, shengjiu.wang@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] remoteproc: rcar_rproc: Call of_node_put() on iteration error Date: Mon, 20 Mar 2023 16:18:24 -0600 Message-Id: <20230320221826.2728078-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320221826.2728078-1-mathieu.poirier@linaro.org> References: <20230320221826.2728078-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230320_151835_106228_B2C818C2 X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: 285892a74f13 ("remoteproc: Add Renesas rcar driver") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier --- drivers/remoteproc/rcar_rproc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/rcar_rproc.c b/drivers/remoteproc/rcar_rproc.c index aa86154109c7..1ff2a73ade90 100644 --- a/drivers/remoteproc/rcar_rproc.c +++ b/drivers/remoteproc/rcar_rproc.c @@ -62,13 +62,16 @@ static int rcar_rproc_prepare(struct rproc *rproc) rmem = of_reserved_mem_lookup(it.node); if (!rmem) { + of_node_put(it.node); dev_err(&rproc->dev, "unable to acquire memory-region\n"); return -EINVAL; } - if (rmem->base > U32_MAX) + if (rmem->base > U32_MAX) { + of_node_put(it.node); return -EINVAL; + } /* No need to translate pa to da, R-Car use same map */ da = rmem->base; @@ -79,8 +82,10 @@ static int rcar_rproc_prepare(struct rproc *rproc) rcar_rproc_mem_release, it.node->name); - if (!mem) + if (!mem) { + of_node_put(it.node); return -ENOMEM; + } rproc_add_carveout(rproc, mem); } From patchwork Mon Mar 20 22:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 13181972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9A63C6FD1C for ; Mon, 20 Mar 2023 22:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4M/q0zqBM2rtaa9I3Od0giADuPiPLXaW2GBg3mX/5P0=; b=go9i4LrOZOAGFN b68PyJGFzWuW0qOg7Kd6KUfGowek7fKQrnNrWAcHCFvCwma/OajicoMesXclj75zuCYwtFG79qzfj sfvf4jmxgIER7OWu6Yo+RS83o8RgF+cS8O7ntU5vMEzY58y0qrfL+/nEqqlJPX5xcir2SZh0413Lx ELV3kATCpf8+RJwLQ+GBngMiRW5ehAwNFQA8xeCo6r1k1fWSpoVkuQG5Vgkj1lrgu2OBfOrV3knmD e23ooEiiEugLPXjPyjtIjt0jgV0rYSFYcc67u1QNITrm7KYZveJ2zFQ32xDWL6ogUQ/WYZS03MOk5 kHC/mE5QlQTVGnYNHVBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peNqF-00AdHq-1z; Mon, 20 Mar 2023 22:18:59 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peNps-00Ad2N-1U for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 22:18:43 +0000 Received: by mail-pf1-x42f.google.com with SMTP id s8so7768098pfk.5 for ; Mon, 20 Mar 2023 15:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679350716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=trrnan71ZHM7JKq0ql81PKKI2hb7rlyx27+ksKXBUrc=; b=f8qUTKDDglZJsgtv/KBhPEPSfsS/rDPVt7Q0ZvXfNE706If1SqJBI8NpCJq27Qo5gT DBGx99X/V+1V/tiTX54m6jRBxlszJZzogDlJCJTGTGIyxt6vbGwLhOM5KJqI9t04HNkL UQiy8VgJ1YxaLJ3QEbxjNGfDTUEzgR0koUy8jLa9VneY6PVluLfJvDPrLj+7E6CzK8OX MpFui5oS0O1cN+E/S3R2STlDyC4eSSr8INCk6CUcgeEVacgLh7uNNFy5QH/uMOp4VMzI m7UzrJVNthCu6l1D+R4JkUqPMcVo8xeHkhGJsyPEFhnBp5JUuQoLnCg4BemhWRypa75W GIHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679350716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=trrnan71ZHM7JKq0ql81PKKI2hb7rlyx27+ksKXBUrc=; b=NBUL+3Iv6umUUu5mb0sNxxtyJP7SJpfHynS0PPbzktf4WTFmfjIx2Ix0vzQlDMWb7Z 392ntrJmhwNLwCVikKW36Dd9CQs5q0Q7L8JIT8V2SaLcgeLgql4VHVITRz6Ej+98OoPS i0roDMdwUe0z298h7acOdQ4NuOWgQmXDTaqIiUyWk9xl5ACTmHgWwV+YTAr146kb00k2 0tMicrQLnWmZ9ocazPPRfkwFOS+YbMwTKIQCkQYgo0Ohqq/OOh4scdQVkzveGlYLhuLE uS4n/yZtFzEY8Mskoi555qdIuCz1+MW/kzD4Kge2dGIIpnIY/YGNcnUQ3S0hf8mp1/AK 1vvA== X-Gm-Message-State: AO0yUKUE1gzOQJb7WPkSJACUuHvgIEK6fv9D2dgja88igAzyTUY7QPx8 XMzVA3j/0P3I+ND/5PNyFUtGfA== X-Google-Smtp-Source: AK7set9+CAhMtLEgvAgzUcAfqrgmuEL7isu84NLQBw1S2LtfyWANSAlBjT/xveWdfYFLX4MYX/jmRQ== X-Received: by 2002:aa7:9ae5:0:b0:627:fb1c:3af4 with SMTP id y5-20020aa79ae5000000b00627fb1c3af4mr342235pfp.21.1679350715864; Mon, 20 Mar 2023 15:18:35 -0700 (PDT) Received: from p14s.cg.shawcable.net ([2604:3d09:148c:c800:4ab5:5131:bafc:4428]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm4459196pff.189.2023.03.20.15.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 15:18:35 -0700 (PDT) From: Mathieu Poirier To: andersson@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, patrice.chotard@foss.st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, arnaud.pouliquen@st.com, hongxing.zhu@nxp.com, peng.fan@nxp.com, shengjiu.wang@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] remoteproc: imx_rproc: Call of_node_put() on iteration error Date: Mon, 20 Mar 2023 16:18:25 -0600 Message-Id: <20230320221826.2728078-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320221826.2728078-1-mathieu.poirier@linaro.org> References: <20230320221826.2728078-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230320_151836_544448_3A23E104 X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: b29b4249f8f0 ("remoteproc: imx_rproc: add i.MX specific parse fw hook") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier Reviewed-by: Peng Fan --- drivers/remoteproc/imx_rproc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 9fc978e0393c..0ab840dc7e97 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -541,6 +541,7 @@ static int imx_rproc_prepare(struct rproc *rproc) rmem = of_reserved_mem_lookup(it.node); if (!rmem) { + of_node_put(it.node); dev_err(priv->dev, "unable to acquire memory-region\n"); return -EINVAL; } @@ -553,10 +554,12 @@ static int imx_rproc_prepare(struct rproc *rproc) imx_rproc_mem_alloc, imx_rproc_mem_release, it.node->name); - if (mem) + if (mem) { rproc_coredump_add_segment(rproc, da, rmem->size); - else + } else { + of_node_put(it.node); return -ENOMEM; + } rproc_add_carveout(rproc, mem); } From patchwork Mon Mar 20 22:18:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 13181973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57D59C6FD1C for ; Mon, 20 Mar 2023 22:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EyPG6LogHK42T7yS1LiOKENeScFzc4kCd1qa9UWWP14=; b=LOBGZFIhiJBA6Z V1k5XbCLdpwEe8yT8Hd6DFbN3XLP39/QbsaVFXlfsOnQZJNUX9cgt1mhMjN4OPiErnzPvCT4wLWDk K50aoY2pCe3hBkBkc8A3O8JtfnvgZUlVfObytKZ4VxXSirCE/45g+uj40QdgFcwEqKA08PGdSVkLi ZHGH468EXYvCOoqzqNNjHoE4W4vWu5JiwRf3GZzxYqfS5PTOIYpV7migpFatF/p3yOw+AaXTDd+ap m466yf7kbCjdvJ+uP0pVNyx3V0Y6Xvxs/8rSwmh+DCtBDD89mMUUC+YMQ/0A7BbqM0UCZgdOM5CKd /ALHy0L3tr2C55PnA+uQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peNqU-00AdSU-1J; Mon, 20 Mar 2023 22:19:14 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peNq2-00Ad8q-2o for linux-arm-kernel@bombadil.infradead.org; Mon, 20 Mar 2023 22:18:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=s/LgoSGK+GmE6/EU93H8+NXO4ccsf9u+CovKfDKWumc=; b=kHoYftMlo4up8OtA2ZbIG4IaHd wAxp8B4myuY6Wzq1ro6I7H0sdsOjY/mmmz8xYUu8srbWW5xYvkYnK+GgdeFmLCob8XrIUqnl7qhko YVZyd1+wW0DjSD+lVXrYssVasjvuXsTLhpGYYkoHSy0dGKwtrZjIDoBciPcbR2ti2i0U3B5Gy2DYf WDkkSuTCKIdI8JnNUNu6xNQGtJSWg6fq8lreXUHCs5klXC0UKOVqeeOfYjBsBJ7WlmwiTVPwMix8g jqNf8eaITXOkecl71d0uP6paxFfnF82DxFmCfvJ9YUThcewIEsj+b32A3Llcs/YjFsOGrzMG0Z9YO z+OEgpxQ==; Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peNpx-0044rg-36 for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 22:18:44 +0000 Received: by mail-pg1-x52a.google.com with SMTP id bn14so59250pgb.11 for ; Mon, 20 Mar 2023 15:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679350717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s/LgoSGK+GmE6/EU93H8+NXO4ccsf9u+CovKfDKWumc=; b=Juoyvhyhe4EVorBJbKfJG5cW+0Su9a6XcIbbfOnxvZcr96R7XCEUjwKzp651fA4P3B xQTMyT2BESSeUn79Pnqz6OzC9LUrZzUtdLXqACH4HLqOKxrIL2/NZdJvjGJGXpsLtYAE nw/AVLyzWI6JfiCXqm/EczR9AWvVtpUC9CXwXegc3rAI8RNdOTls4xpkQza4+o/no/6Y 7hr3Fti1zNNrz37wUl546X8sx1IB46mbLF2BrQqeqPEYcwljyanNJ2xpNTqfBtIq2KtA bFHJc5KVtP416bgv6YlM5DHuQ600W/290Wiq5+8gdOH8t14XYl3jAr9ENimoM/Yo8Xgd DXyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679350717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s/LgoSGK+GmE6/EU93H8+NXO4ccsf9u+CovKfDKWumc=; b=aFlhG7I3hiZFUHLSOoBsnJ9oHngPoZtSAv71PIBAC4jeFK5+sLK4IV0WeY695fIC+r Uq08r9DkN/8c2UO18EAIkfqBT1ZmYBTaPVnUZDs9Y+RxSXHdNgdUaohjftn8DdiH6+ld CcGilpD6qhDcm2fFzfLS0e3Qaa7LyZmGo0Wt7qkteqmZRmc4W5Fn/aRcQ8DVd56lzzB4 /iq9XRznW4HtFPxXFIjDqFnCsk7xnwyvxpsQYDr+7gJgNOjo2uor2/HXLUwcE2oL6oBn 3uw2XlBAJNNzRnWwkd6XTA/r/7gsavAItobwIMTAAPCh32tAif/PH+3TeDozda+dJ9U+ /L9w== X-Gm-Message-State: AO0yUKWM5JeSR3QGx1v3WFNfh3fA6O7zNBibu5oib0zzfCQeo7yome/E /iVq8FkKaVg52jzDiOk9KpE9SA== X-Google-Smtp-Source: AK7set9KHdWfT5WQ73Y09ku7vZjlXSifntdEtuo1i/gz6GfDAugJDKSdSdauloxms2X4Yf1Bm9z7HQ== X-Received: by 2002:a62:7910:0:b0:625:d630:4e1b with SMTP id u16-20020a627910000000b00625d6304e1bmr293831pfc.31.1679350717432; Mon, 20 Mar 2023 15:18:37 -0700 (PDT) Received: from p14s.cg.shawcable.net ([2604:3d09:148c:c800:4ab5:5131:bafc:4428]) by smtp.gmail.com with ESMTPSA id e15-20020a62aa0f000000b006259e883ee9sm4459196pff.189.2023.03.20.15.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 15:18:36 -0700 (PDT) From: Mathieu Poirier To: andersson@kernel.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, patrice.chotard@foss.st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, arnaud.pouliquen@st.com, hongxing.zhu@nxp.com, peng.fan@nxp.com, shengjiu.wang@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] retmoteproc: imx_dsp_rproc: Call of_node_put() on iteration error Date: Mon, 20 Mar 2023 16:18:26 -0600 Message-Id: <20230320221826.2728078-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320221826.2728078-1-mathieu.poirier@linaro.org> References: <20230320221826.2728078-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230320_221842_380467_04D0E8BC X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly. Fixes: ec0e5549f358 ("remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Poirier Acked-by: Shengjiu Wang --- drivers/remoteproc/imx_dsp_rproc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c index b8f268d41773..21759d9e5b7b 100644 --- a/drivers/remoteproc/imx_dsp_rproc.c +++ b/drivers/remoteproc/imx_dsp_rproc.c @@ -650,15 +650,19 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv) rmem = of_reserved_mem_lookup(it.node); if (!rmem) { + of_node_put(it.node); dev_err(dev, "unable to acquire memory-region\n"); return -EINVAL; } - if (imx_dsp_rproc_sys_to_da(priv, rmem->base, rmem->size, &da)) + if (imx_dsp_rproc_sys_to_da(priv, rmem->base, rmem->size, &da)) { + of_node_put(it.node); return -EINVAL; + } cpu_addr = devm_ioremap_wc(dev, rmem->base, rmem->size); if (!cpu_addr) { + of_node_put(it.node); dev_err(dev, "failed to map memory %p\n", &rmem->base); return -ENOMEM; } @@ -667,10 +671,12 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv) mem = rproc_mem_entry_init(dev, (void __force *)cpu_addr, (dma_addr_t)rmem->base, rmem->size, da, NULL, NULL, it.node->name); - if (mem) + if (mem) { rproc_coredump_add_segment(rproc, da, rmem->size); - else + } else { + of_node_put(it.node); return -ENOMEM; + } rproc_add_carveout(rproc, mem); }