From patchwork Sun Jul 11 16:12:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 12369227 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1481FC07E96 for ; Sun, 11 Jul 2021 16:13:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D431361164 for ; Sun, 11 Jul 2021 16:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232430AbhGKQPp (ORCPT ); Sun, 11 Jul 2021 12:15:45 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:62471 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbhGKQPp (ORCPT ); Sun, 11 Jul 2021 12:15:45 -0400 IronPort-HdrOrdr: A9a23:GO3MtKBQts1LjwjlHenG55DYdb4zR+YMi2TDtnoddfU7SKOlfqyV8sjzqyWZtN95YhhJ8uxoU5PrfZqzz/9I3bU= X-IronPort-AV: E=Sophos;i="5.84,231,1620684000"; d="scan'208";a="519399375" 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/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2021 18:12:56 +0200 Date: Sun, 11 Jul 2021 18:12:56 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Alexander Lobakin cc: Vladimir Oltean , Florian Fainelli , Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: [PATCH] dsa: 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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: kernel test robot For_each_available_child_of_node should have of_node_put() before return around line 423. Generated by: scripts/coccinelle/iterators/for_each_child.cocci CC: Alexander Lobakin 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: de5540965853e514a85d3b775e9049deb85a2ff3 commit: 227d72063fccb2d19b30fb4197fba478514f7d83 dsa: simplify Kconfig symbols and dependencies :::::: branch date: 15 hours ago :::::: commit date: 4 months ago ksz_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -419,8 +419,10 @@ int ksz_switch_register(struct ksz_devic if (of_property_read_u32(port, "reg", &port_num)) continue; - if (!(dev->port_mask & BIT(port_num))) + if (!(dev->port_mask & BIT(port_num))) { + of_node_put(port); return -EINVAL; + } of_get_phy_mode(port, &dev->ports[port_num].interface); }