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); }