From patchwork Sat Feb 12 22:39:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 12744448 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 492BBC433EF for ; Sat, 12 Feb 2022 22:40:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232173AbiBLWko (ORCPT ); Sat, 12 Feb 2022 17:40:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbiBLWkn (ORCPT ); Sat, 12 Feb 2022 17:40:43 -0500 X-Greylist: delayed 63 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 12 Feb 2022 14:40:39 PST Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03ACE23BCF for ; Sat, 12 Feb 2022 14:40:38 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.88,364,1635199200"; d="scan'208";a="21055354" Received: from 203.107.68.85.rev.sfr.net (HELO hadrien) ([85.68.107.203]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2022 23:39:33 +0100 Date: Sat, 12 Feb 2022 23:39:33 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Anand Ashok Dumbre cc: kbuild-all@lists.01.org, linux-arm-kernel@lists.infradead.org, Michal Simek , Dragan Cvetic , Jonathan Cameron , Lars-Peter Clausen , git@xilinx.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: versal-sysmon: 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-iio@vger.kernel.org From: kernel test robot For_each_child_of_node" should have of_node_put() before return. Generated by: scripts/coccinelle/iterators/for_each_child.cocci CC: Anand Ashok Dumbre Reported-by: kernel test robot Signed-off-by: kernel test robot Signed-off-by: Julia Lawall --- tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15 head: 966124532656bc95d781abf57531e4cd4f962237 commit: 1459646ab280aa68c3c4fa1d9552ea21f15d7a2d [543/923] iio: versal-sysmon: add driver for Versal Sysmon :::::: branch date: 3 days ago :::::: commit date: 12 days ago Please take the patch only if it's a positive warning. Thanks! versal-sysmon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/iio/adc/versal-sysmon.c +++ b/drivers/iio/adc/versal-sysmon.c @@ -875,12 +875,16 @@ static int sysmon_parse_dt(struct iio_de for_each_child_of_node(np, child_node) { ret = of_property_read_u32(child_node, "reg", ®); - if (ret < 0) + if (ret < 0) { + of_node_put(child_node); return ret; + } ret = of_property_read_string(child_node, "xlnx,name", &name); - if (ret < 0) + if (ret < 0) { + of_node_put(child_node); return ret; + } sysmon_channels[i].type = IIO_VOLTAGE; sysmon_channels[i].indexed = 1;