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: 72514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1474483wrt; Mon, 20 Mar 2023 15:46:09 -0700 (PDT) X-Google-Smtp-Source: AK7set8sUsEWUDlHCC2T4GZdpSFgg45rHEEml+eq2CDUASgnEaEkhWkpE3DfeG7e1FA/k/LnFa/w X-Received: by 2002:a62:1990:0:b0:625:b37d:875 with SMTP id 138-20020a621990000000b00625b37d0875mr301990pfz.32.1679352369214; Mon, 20 Mar 2023 15:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679352369; cv=none; d=google.com; s=arc-20160816; b=LlcqiZmBoxXJpE+IP89ruUhq41Q1Ys5hzFdO8sqwdJed8gMdv+C8EzYP4hc+o8WMvM Mu72SNTkrGSUe6rk91A1fGU8ILzR0PvMhSF4uY4VJF0KyB4jIwki04N4oRgWjBZnlSEt AMp3ZzTDMJamIOr45XeRwKdgHZ066NFm0qpAxvrVHu1UJ0DcIYtxIDQkuRD+nfAUiRlI 275w2aC2B3cRSNoYZmJTiRVrTsOeaS2Mr8zey9H0u2WlHKheMYZLWKlWrnkiw8FE/y5p 0ri93t4a4nyL9NM6nBYQuc00+7xt8YNjaBycRRwnTsbx2QHMEtpnJRtaYpVMZ9Bhvlws 3V1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mPLmB3dzpBczm3qRE9s2V0X3S8uJO7/jVxWe+sb20rE=; b=bB6SdO18frMBb1BHg7Wc6YP74QdEUNpgXsS9n/oPphXn5QXd6hJsufH5y/eDD4L8ls IeDr1u/nbIAzn9qI0WkSehyk7vD8iBMXSi4TnSAieNJsTSpy0q8+V3Asug96QkjXbGsL DXOtojbIGwq4exGHwfc7V5dTfjxsyMEwCntGpFFJTAw2h0pNoue+MpPcG8n012X+Uoa7 UNBpEaAT3x10t18jPumMV21vg34O+qReYwogmHfTaUf9QEPYuDKtGyZhUDvExnzQlBCs qXDB9Av+LBK9Va27uPIiLlRpY0XIAg2UeJIzq2rZq9hlYJgXH2Xiow4KA3NJllvZoO7k 3G3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VZXByqS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 31-20020a630d5f000000b0050bf617d84fsi10959977pgn.249.2023.03.20.15.45.56; Mon, 20 Mar 2023 15:46:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VZXByqS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbjCTWUf (ORCPT + 99 others); Mon, 20 Mar 2023 18:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbjCTWUQ (ORCPT ); Mon, 20 Mar 2023 18:20:16 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CB3B1D937 for ; Mon, 20 Mar 2023 15:18:31 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id om3-20020a17090b3a8300b0023efab0e3bfso17987509pjb.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=SFPrIsPF//kiEYZQq1GxdViuVBQghqNt8wksW9Pe7dTZsrgeEM1DdngZDahu7wb7eT rwscNuW/+NIr/abMwj2QVvn/UdQG038dLK8YR0aGG5hMayt0asHzAznMb8Pl4iR/0qDC TeOrEvx5MDZTUk2Q6L0v1svZWh9wENGbow7kbHeeMGA+JT703PGH42FlRCOx253UM78+ 4rOCRbciQT6IT60/ckoLtEusqY/Q5/3noiaByYRgyOCfuRdB0vUoRB1KZgMrWTdVydMS OWfh9tkQJ/nWeVvte1PuFMEh5so4/pO3p6Lrjb5bb5kPEcaZJYUndxXWbFGYlYHxJDl5 eUpw== X-Gm-Message-State: AO0yUKV49/s+zmWFQvdaFX+9m3mV5miPuhYG8Ma9O1an9z5oSaMlE97p jn/skHjC91kBMz70514ufp2vvA== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760928590233574009?= X-GMAIL-MSGID: =?utf-8?q?1760928590233574009?= 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: 72512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1474207wrt; Mon, 20 Mar 2023 15:45:26 -0700 (PDT) X-Google-Smtp-Source: AK7set8ItAUGRnZMr+SiL1/ReYPYDsjQ3yazO5dUwvBVWj8tZEl4RROZBTZGD4+Jao2db/KY1DDc X-Received: by 2002:a05:6a20:c754:b0:da:6dd4:84a2 with SMTP id hj20-20020a056a20c75400b000da6dd484a2mr124925pzb.13.1679352326245; Mon, 20 Mar 2023 15:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679352326; cv=none; d=google.com; s=arc-20160816; b=tD33LwBMoiG3AGpAkbeCt1bJtnzr89e+CfZdgsmsKIFaPpskW+LYy6S8mPoKyh/kYq wSQ/sGmvU8S/rV4JsdNBHHkFeojTlvwsUqzYD0swdj74QdDz6SuhPP5PiN+FyGD9Vkjw lbIrJm9+Whvocu+3+7C3jWhN0eLPdZgsaI9PnCX7btRaD56UHaEPlYmJ42nzgFnq9ZwR 8KPkrU1YWCuu/dTCEsi1I/Dh1uCXaBFU84+R7SaQkZDCyXxlkR8IN91zhgII2gVsqm0c Wn6ym+RwIfvLRD1M1X2nCSW6QKnt9grMhepjcGEE+RAS+3Tq7odVBHBAYfeJj3baSyOx 94lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lFdP+n8hU6K/nm3EJ5X3exiUwV1teDwsbi7RZq6Ti4k=; b=AF1/m8boSYadW/WAcFwwymxQeQvTHmtj8RjbUJMQTNbS/7UQw25U0Wh96I/DGofSjY /b/zZ1Y+EpiGAa+KoDLwl6vmxGBSmA1P3JlQUDZd+pSd77YmUNbeHjsMunxnda82hyaB NteYwSP0FvG7jTRaq5N3kiFAa7P52YVqGi0wywqV0EaJJRElaq+47DSpZEiUu+r01pHX UpOwo5j7vkpc6Vm1ZkiK+LwEBN9L4XJeyNyuTGqX5zPsArhbL/3nEYsqQHH0flpRHd+7 0wJPtYQdR0KxyZ7KUtWW1CqmJuFtkdhromgbEYUvq6We4kvFUJNcis9vQVht7m5QBWd9 nWaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mKWIQ1ue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v190-20020a6389c7000000b0050be32f3b3asi11776661pgd.315.2023.03.20.15.45.12; Mon, 20 Mar 2023 15:45:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mKWIQ1ue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjCTWUi (ORCPT + 99 others); Mon, 20 Mar 2023 18:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjCTWUU (ORCPT ); Mon, 20 Mar 2023 18:20:20 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73184FF0D for ; Mon, 20 Mar 2023 15:18:36 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id y35so6359575pgl.4 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=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=gyF2v+Nk5c44ZRbFaNUAOkfk7yvJlrIsQjEK3GaH7/JNWL/n23cUgD7MTHBMIln0Rp aEmVEhF/qjmh0uSFE+SnG7WUcFTgmtuEHktepJXc4+vIW3fbFjqYkIIoA+FsmD79Wqc7 2CZRly6446+z3+sBfDjmFYJHzFiDwFQ7T1mbiJnMBzm8S/UnM5f/MnK/tcrm3S+kgkNA iSlYuk4OeaEipgJokP+ADjECo9WF3TC0B/sEY6KhnNbseFL0AKnQ/6snvqzmOGDw5K/G Xtj9/2vfOEB4YSDr6nBnU56NnnmG53rTfIQnvQiIrW2PaAMmHARsNlkCF3HyleLFKzSs O1hA== X-Gm-Message-State: AO0yUKWAX3bhMALvGkk+TxLh+c4EOPX2KCeQHhWeozR3EWWLcDmcHC2b 8lbmU00VomsNNS4wRVHfwRW93A== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760928544904386250?= X-GMAIL-MSGID: =?utf-8?q?1760928544904386250?= 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: 72513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1474451wrt; Mon, 20 Mar 2023 15:46:03 -0700 (PDT) X-Google-Smtp-Source: AK7set8FT3l2Di3psDi4srOuFgiMiEVQzK9fP5Nrsm8KIxQJn51QZM/QlF7+KU3r/toScDt6YYWa X-Received: by 2002:a62:1954:0:b0:628:9b4:a6a3 with SMTP id 81-20020a621954000000b0062809b4a6a3mr972841pfz.2.1679352363482; Mon, 20 Mar 2023 15:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679352363; cv=none; d=google.com; s=arc-20160816; b=PLtPKO09vSqKRcvenHDIAT5e4qCSCejFM05qBQS+tcaZyy+ClHTRvYKfuMpfSGA/EK Y98XlivNdFUVn9qhJ0AVbxeRXiaMgyPzJSnRwyLy40SQ3HpXSxPlSgrmzrUmWPufLtx4 X6RLxoXEzfpwroVJcQeIg0WJrMFzqjNFxy+o/CNPoJXEjqiY62r14Iam+zb2daSajt9u Zpko/K5fnWc00DuWyJBhXRMEm078LCLQGYcfQJk9+L5ytHRJu+6avWkCEYEYBEG1/E9o 1E+M4/dKI3dZajOu0OKZ5jdP26YmmZAd4ODOw+1lSwDhxvc+clVMGY3h/70ilgwepMLo 8XCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7SvawGG1lzE2m2LYlYl0Sje5AT1/P8cyqdj5Tvo8pXw=; b=aMcv/IzJQyusvtm9EBtLgH7j4EJYlEkZSFjtpYfwwojdK4ov7gvklkeJsVvbpeSEEF vRrEDIjKUyqcojfBrHNjExXjHqMj8Bgb1Rk1dMca0xJUZRx8LC0UchIe7nltNtcxEHve oNwTxtGLXALb1BfWjn7JWt+jQO6PGAEEPa0wRHy9Etl1dKtmJ3yDj4pKtIN6hkoW951r 9Xnr615yxL8DuVW5c8seFR3Ayt+Uh+IDAKk38E+Bp6imhAQMZT8OLXEYzN2EbYYAay5x PVoCkUCWHAEPFqmzlAXhxFOfF2Uge82gLX7GuYNEtuSQn1xg8brZUI9LFK9cjVtk56CH R/Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PvsJCIxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a056a000a0700b005a8b856ad4csi12149818pfh.205.2023.03.20.15.45.51; Mon, 20 Mar 2023 15:46:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PvsJCIxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbjCTWUo (ORCPT + 99 others); Mon, 20 Mar 2023 18:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbjCTWUW (ORCPT ); Mon, 20 Mar 2023 18:20:22 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D6F418145 for ; Mon, 20 Mar 2023 15:18:38 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id s19so2188283pgi.0 for ; Mon, 20 Mar 2023 15:18:38 -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=M0Rjy+kT7BX+XiJUJy/MfnfLXCMWi+e5nc2FLKwQTH1rfYF/jb7ORubJj9pabomS4+ vFNps8W7KAp8fyH9ZquHemFwKeJDO6rHUTVnSnitAsrzcO6EE4aGR9uwCeMVvQg7sSxd rsbSe1Vi3Stq6xTK0VlHzZdt9J+UU1kAKCGtnWDPcPv60RAgJbxe2FhkLJvSeBR4w0us uNj8mI7IwoXWS1JKlKc3yPIXoBkSW44j5BryGo0k7+Yo8OdFMl7aFfowKUMMg7nyNPZO bWZy2ybGzDi5fnnwOjc8fuk7NI3T7TEEztpwaA3Je2yIVGDi8capiT8y8ilsMhj2wpDs /jVw== X-Gm-Message-State: AO0yUKXZo/4cT8ZOQMX+X9ccWtIKLwJmVEyKyZM/98qPWYiIcqRhhLzw lfM1O6saVzh6x1TNC7lmJWm04g== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760928583886992160?= X-GMAIL-MSGID: =?utf-8?q?1760928583886992160?= 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: 72510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1473270wrt; Mon, 20 Mar 2023 15:41:43 -0700 (PDT) X-Google-Smtp-Source: AK7set/cUS3aNDLkxq8bgxfdQHifpWRqyBm2RgcGl2dpAC2eqDh9aQcYfK2tX7mG2afvIKRTBTxF X-Received: by 2002:a17:902:fa8b:b0:1a1:bcf:db5f with SMTP id lc11-20020a170902fa8b00b001a10bcfdb5fmr31819plb.25.1679352103261; Mon, 20 Mar 2023 15:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679352103; cv=none; d=google.com; s=arc-20160816; b=tde6+2pjf4y+vLtTLv2sc+mgb/rzfkpTYIWY8HoRX2vwi6mDOo2ybolL3+Pyl8iR1X IQlDpTRi7a+Vv7P0mLHP3HZmnC12PeIoAxdZUjAsuytoEDUxnaBFbhmBseUErBZSFZbc cs5ysgklbKEik0jjbx/w0yJ9KoQdNyximiQ6zW1EkgejmqKqRxZQtFea9OuhsPct1CvT tV02oNaHIlQW6l4TfXbkCMw9O+EI4ZA6kF57JeW0OzhzpNpfyJM2QbSA2Y9f6kuYbGpU x9dNxpUQjPcVyk2uWea6urzptbRhs4+Sq0kzoT+g2lhXVIdJwcK6XI2h4PYlnb7AxqON gu5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=trrnan71ZHM7JKq0ql81PKKI2hb7rlyx27+ksKXBUrc=; b=b4XwtduzDfHcC4Zkgp+FbnErjWYQDzjsbgI/8GyBXTkqlyKb8LWy5dOu+PF9Rgg4FS lClGp6YW3VEb6srCgvyzN0I+bhEb037cfox9G/H8+7b6xesKC7Nnh1abQTRiJYcSO6Ca BVA/qw2AP0TaAHlx9eVu2Y7udVjTfUYVjOjc6yM+IfU/r1ZMYx1XAEw6SF8Z3L9PRRhR tiPh33aaw+LUnKp2Occ99JiaPRGNUzPC0BNplJRwZTUMFzi5Fb4NxvyzPWPNrDBjMhyH ol0tp95zNkwp2qlr4O6Yj0lIH0a4zh0pDESYIMb/9mIJ4OOCgQo5iBCK/qO3M8waYDoE hLqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f8qUTKDD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a170902b20c00b00189c05664e8si11202125plr.563.2023.03.20.15.41.31; Mon, 20 Mar 2023 15:41:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f8qUTKDD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbjCTWUw (ORCPT + 99 others); Mon, 20 Mar 2023 18:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjCTWUY (ORCPT ); Mon, 20 Mar 2023 18:20:24 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F00B9193D2 for ; Mon, 20 Mar 2023 15:18:44 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id i15so3858749pfo.8 for ; Mon, 20 Mar 2023 15:18:44 -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=gW3fWNJ3z2h7846DU+bQWUki+wg3Wr0UWSExWqZL7FmjH3+7/VGTcG8h/07u1RsKS0 7PmuwTbNnScDSczBt49seaNmStCXSU348dRxMszE7UlbgWOlkZGP4hwNUOs5NYkonSLP aCr1etCFJ4nx+FQWzx+konCZcCjqAnJgyammEr2itNXA3Rl2uAKiLZB/EfYg3t/Y08aD 4vplbZzc6eLBRNzBFtNztqGZeh9s8am35mxqWfHNq1w1kjo3bDhd9NKkHq4pImpK45t3 A4MNT8eR24N6lV9jiiXcQYawypYIGlLC3Ul6pLvAYLqbCsW4gnnVxHnVwyI+OUrpT/Ol Nghg== X-Gm-Message-State: AO0yUKVTjRZMzFGM6AImChuwm6lfTQ+KLTkTNfGUL0ZZupSyYv7BcYv5 zlX/HZ/xaZ7QH3ztQPmzQbF/Ug== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760928310745278509?= X-GMAIL-MSGID: =?utf-8?q?1760928310745278509?= 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: 72509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1473218wrt; Mon, 20 Mar 2023 15:41:35 -0700 (PDT) X-Google-Smtp-Source: AK7set9/dr7mU3FKDJj4++3o9z8EhvBXuxbVD/D3Ho+BJwlK6n7Dqj5Ej6dBqzqmJPFw9bmxJSaY X-Received: by 2002:a62:1b4a:0:b0:627:f9ac:8a33 with SMTP id b71-20020a621b4a000000b00627f9ac8a33mr343192pfb.13.1679352094962; Mon, 20 Mar 2023 15:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679352094; cv=none; d=google.com; s=arc-20160816; b=JaPnBR4y/ySd8ywqD6mlw64EOEPifgwcTUsQpufORqEz/AvbmO9XWjXSwvBGpi3IgO 8rcYp2nRMa2VV8ZwlWWeNWmEVn8RuJkdvpV2WZrsQhsWTuOY6cFxOyclwn2I/3UR60Rx jlXCEQAP6OzbRxVd5j5m87Lo8WTqFMRbYhpF+LxoiAqWMaYXz6kU/gmff6MzpL0HjkZ4 Cm7h0xe+sNCLk0Eg5Oso0Pa1cP8uwMIzisjCvDJwoRyeMFfQHPXQ/mWSoBeHq3j46rnu qsKHlD5KAspn6dCoTsekmM9Z5TldlXiOmtUptotNuhfqdoSZwADHW48kdaBZGw2Fkekr /cWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s/LgoSGK+GmE6/EU93H8+NXO4ccsf9u+CovKfDKWumc=; b=Y0YATx52CtgkZzYFKXb6rhyAXVg0aQNNcy4GvrGoJYDPqEg7XngYWduqvUcxzVuBr8 rbU9ksGA7zP9ZwlcpQjc+8x3KPw7CBFD0ZasCwJE54DlAaiSK1hC/hIoksDQWGXYr0k7 kJAx0qXiD5IDaLb5eJdU9mcFwzJzmHhZsCcSTBG0HcNjCuORt4wSEQnoIyUBEO3xPm86 DTz4LyPbXTJIYKFb25r2iDgfNzDKTDLf+ft9wMIVWcPomP/G5jENB7f6xgkxiyiU8Oi2 pX/NAng4nJx/DWbcfi6JCRoxRItOf2ZIGhXnTPmsbwNOlMG0EHdB3Nk6RR+RPm19P0V6 OZjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Juoyvhyh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a056a000a0700b005a8b856ad4csi12149818pfh.205.2023.03.20.15.41.21; Mon, 20 Mar 2023 15:41:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Juoyvhyh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbjCTWUy (ORCPT + 99 others); Mon, 20 Mar 2023 18:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbjCTWUZ (ORCPT ); Mon, 20 Mar 2023 18:20:25 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9801838E86 for ; Mon, 20 Mar 2023 15:18:47 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id q189so7512794pga.9 for ; Mon, 20 Mar 2023 15:18:47 -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=FyBUPGjmYIDD9jO7RudD81Khl2s6Kq1YRSEWs9KfXTkGAz9sjox2sx8ai0L4ITS9kI 652iNQuO8nKBTuMJTeavmr9A66K5LgVIRrgWNAFH6X+0pqJvCFbOGwvp4aN2cCGcTSp3 h8cnbq66OVpZK29Fn5OBJe9/i8QBjdTgUHuTTD9MUfL3YYL7LnS3IH8npozvVG+Iq8oI d9wsmbnoKpPMuzVEnKlsDsZz5nw6opYPDt9HRTOaX+ircpW18sF1XvFGdToH8SyIO9HS Osvea2pDQ57RolwDYYmr7ZDqwCnvLk39v8tH6Cm3XB2VgawYY3CR5Eumuxz7DolncaWm UN8A== X-Gm-Message-State: AO0yUKVNZMkIRWjCRMxvtqSEycmSvA779OggEu2KQA7uT4TEiMZNluT+ GTxBhlSENETHaNrR2Zbtfz4LNw== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760928302074091921?= X-GMAIL-MSGID: =?utf-8?q?1760928302074091921?= 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); }