From patchwork Sat Jan 15 11:11:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 12714367 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C35EC433EF for ; Sat, 15 Jan 2022 11:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231482AbiAOLLk (ORCPT ); Sat, 15 Jan 2022 06:11:40 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:53118 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbiAOLLk (ORCPT ); Sat, 15 Jan 2022 06:11:40 -0500 X-IronPort-AV: E=Sophos;i="5.88,290,1635199200"; d="scan'208";a="15964437" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jan 2022 12:11:39 +0100 Date: Sat, 15 Jan 2022 12:11:38 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Konrad Dybcio cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Mark Brown , Andy Gross , Bjorn Andersson , Liam Girdwood , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] regulator: qcom_smd: fix for_each_child.cocci warnings Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: kernel test robot drivers/regulator/qcom_smd-regulator.c:1318:1-33: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 1321. Semantic patch information: False positives can be due to function calls within the for_each loop that may encapsulate an of_node_put. Generated by: scripts/coccinelle/iterators/for_each_child.cocci Fixes: 14e2976fbabd ("regulator: qcom_smd: Align probe function with rpmh-regulator") CC: Konrad Dybcio Reported-by: kernel test robot Signed-off-by: kernel test robot Signed-off-by: Julia Lawall --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 112450df61b7373529b0fe4c122ad13b89d80a8a commit: 14e2976fbabdacb01335d7f91eeebbc89c67ddb1 regulator: qcom_smd: Align probe function with rpmh-regulator :::::: branch date: 13 hours ago :::::: commit date: 9 days ago qcom_smd-regulator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -1317,8 +1317,10 @@ static int rpm_reg_probe(struct platform for_each_available_child_of_node(dev->of_node, node) { vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); - if (!vreg) + if (!vreg) { + of_node_put(node); return -ENOMEM; + } ret = rpm_regulator_init_vreg(vreg, dev, node, rpm, vreg_data);