From patchwork Wed Mar 5 16:37:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 14002976 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F6951AAE2E; Wed, 5 Mar 2025 16:38:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741192687; cv=none; b=VGQBwevjiSIqPxkBOFjyxQZgKznlkvCpzyscGxDYp5V7GYxFm5EYP1n+UrgRDDWIR+O3aWUGbalBGcMBXPJS8q4BBLB/1LvfW2X0EGUmNN55daVEvMFxNvK1fHOGfaPTkyUDTC0iRzKRtlYLfoqaIpSOrnG+qyYPk6lCAfxLqVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741192687; c=relaxed/simple; bh=k2M3/q/adRFyhot2mgf/CMtxVEr7FsGvmTY6Z+hgrGk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=udL2jY7tr1v0DiZjsZU0XogNePoWLkdwgfxYGNzJSb8+YXwvSGs6P51mTD8KUhGC9HfCt5fjbloXb3QrpazN0T6dctYnCUpJ7tJY+ZrTLh4fLGBrpJY6qL/yF7JTftI4reC7lTNtgB6OkLumnFT4vXy4gki7cIURqXzgBSX4ers= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: ny+nymeWSVWinr3KFTNOpw== X-CSE-MsgGUID: ktDably4RyCY4HY6FxBxvA== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 06 Mar 2025 01:38:03 +0900 Received: from mulinux.home (unknown [10.226.92.17]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id B365D4017975; Thu, 6 Mar 2025 01:38:00 +0900 (JST) From: Fabrizio Castro To: Linus Walleij , Bartosz Golaszewski , Geert Uytterhoeven Cc: Fabrizio Castro , Simon Horman , Laurent Pinchart , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Lad Prabhakar , linux-renesas-soc@vger.kernel.org Subject: [PATCH 1/4] gpio: rcar: Fix missing of_node_put() call Date: Wed, 5 Mar 2025 16:37:50 +0000 Message-Id: <20250305163753.34913-2-fabrizio.castro.jz@renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250305163753.34913-1-fabrizio.castro.jz@renesas.com> References: <20250305163753.34913-1-fabrizio.castro.jz@renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 of_parse_phandle_with_fixed_args() requires its caller to call into of_node_put() on the node pointer from the output structure, but such a call is currently missing. Call into of_node_put() to rectify that. Fixes: 159f8a0209af ("gpio-rcar: Add DT support") Signed-off-by: Fabrizio Castro Reviewed-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven --- drivers/gpio/gpio-rcar.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 2ecee3269a0c..7208739cd2d4 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -468,7 +468,12 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins) p->info = *info; ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); - *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; + if (ret) { + *npins = RCAR_MAX_GPIO_PER_BANK; + } else { + *npins = args.args[2]; + of_node_put(args.np); + } if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) { dev_warn(p->dev, "Invalid number of gpio lines %u, using %u\n",