Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp550675lqo; Thu, 16 May 2024 14:06:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvBI2zM+N1at/6K25sfy8W+FE53C/wg1Q7R0QbSdXakegsSMoJcfp1rdO4okWWv7uJlU61xymmhsdnAWsteQkB985pU+X5vBibEkVjfg== X-Google-Smtp-Source: AGHT+IFLuxbaZaD5Wvv1okdCivb39MS8gL+V/TxkDDUL+6yvI9AzW3LMzMx7WecOmuBvsp6/gn2R X-Received: by 2002:a17:902:c411:b0:1e2:a162:6f7a with SMTP id d9443c01a7336-1ef44049602mr244245495ad.43.1715893572016; Thu, 16 May 2024 14:06:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715893572; cv=pass; d=google.com; s=arc-20160816; b=AgGPhwh42lHCz5VGVRI1id1U4qAMhrfnaQImi/Qe4NkToffs4JISWPrKTWhrDlabL0 DA4TogSgU7j+ceQB35fn7Yqi+G2AmKYfMYtavfMtT0A+/o4DjcZJSzv4san5iO3MH/Uk fX2XszDB/8okUg4hkojAm7EnmesRbVhGSi+ibvgfi13hNQcu+1FTAAtovjBJzPgjYJy4 kX3iaVz8QCky9N7tL/qBlGb/jUSXReSx6sVyKMprjfslX14t4PP+frWF1d+4x5wnED6P QWurlt5VMafoWUWpVNQ3w4qiYY4WC9wiV4WxLOwbf3sWKAWYQBBr4PayM3V7KQ3Gpi/8 8nqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=vdQVJALIhd9J+5MaB3JGG80Txdx/1fS6o6hU1+crkwk=; fh=AP8gUGkugozsDEWSkAIS4HOPt4xuQEzxsHfZuuQbqoI=; b=JUzFLAhq09BrFBHWqRlmVC2xPYw2y34e6EyIU4OktMQ/pvYlXYUCgeenlgLbsLOzbU uvjLOqoCOX6bB5FIbTjLQy0gbTJRa0LekCn21VTZb4VHoPc4bu2POsESZSx9B/sm2vu2 HAegP3lyN2FOUESEsYrgesK/ViIwDsgfvwQXHdEpR7XwrgCj2F67GR9k6QLrc6B3vt3D FgdM4K4jwf6LQHngXqureqojE1jYGiFftNMffTPwTfpTkhkzZR5gIWfS9T+HJwtawzwU tduLft0kCx83AWKOtRANUqBCbnRvB8d0weInTNDFjyirbnbgIn3JCqn2VympFp/41+oi NrPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O9xpuRdU; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-181580-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181580-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-638bbadd05asi15055620a12.659.2024.05.16.14.06.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 14:06:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181580-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O9xpuRdU; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-181580-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181580-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A3389282BBB for ; Thu, 16 May 2024 21:06:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F73815820F; Thu, 16 May 2024 21:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O9xpuRdU" Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEFC1157E88 for ; Thu, 16 May 2024 21:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715893561; cv=none; b=DGbdy8hUY9+CpWqiM7IuH6aVoJLRkd9YqgQhtKMD7ddel9EuET+0UEuBH372r/2CUPh4tkBOoSORmOnNQ2M4WBiNyjqq2wRAUKfpkH2n6FyOSh1c7v8+dwIRrp1P6dBhWwDacGImdxCIAmQDtdiFq79eXZdH5KTtqRkJw//Ip+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715893561; c=relaxed/simple; bh=kB38o85pn/GJarPAddnJlZVHN6WB91yX6h3Qc6dHZsM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VFjVolCHUm2dM6GZyNq7xa5l0+/HoMhNCYhA+w1C5Ot2HqIBM07ras6aMGlHcwfYWxXqyNskknckHYIrbU2tDrtjhSzHgk7TLlWh9rBAeOgkxlKD/LDKKyVYW6plb9vTxh/U/G9oZKKzSIEJVwgKsuvrXMfEo2ygyUgw3fZTZJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=O9xpuRdU; arc=none smtp.client-ip=209.85.219.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-dc236729a2bso8466532276.0 for ; Thu, 16 May 2024 14:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715893559; x=1716498359; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vdQVJALIhd9J+5MaB3JGG80Txdx/1fS6o6hU1+crkwk=; b=O9xpuRdUUDqcRavlYV2GvPe9of4mRVouJb/lhck5tnxRggTC3cvzQYa2AIiiwt7jfl YrzTdIgdxy9DMN0d82cSpxjgRP14Kbs6S4fluFLs4Xue1ptB4O2ndn8c79HNmdyk1jmK nDS/FVDal2+jQtG1Onh9SRwKt0L8zm4fPVJ6Z1oGVpaEdw6qDIYo4KjQcfdgLT/Zz0iG fkH9fHaKUNexxDCGwFbvKK4zPikzh4C+y6XVuwBLxOTZb0jaxlD5AjDKpi4DxsSGz0Cj ZdCTpYMOjmju6Us4Av7NInpuyOYtofgEyDDkfzZYb0wY+56Ru4ONQJKgCV3YXoomRwEW MDLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715893559; x=1716498359; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vdQVJALIhd9J+5MaB3JGG80Txdx/1fS6o6hU1+crkwk=; b=X/hN0OMOrP9kABNMI6roLf+qnN0JQbW6LQ1HCmPfwqGFmt8RLoF5xb5cOTC8J8/Rd3 0Tjn9yshnvER8hZ0EdrYH42yvy2cadaAjCGC6O636H5mPn4ZjaHzy07jBl4iUAx7FL+B 8WVHuK2H7C9iGUpdvjwd4AOu1zBC0BvvG1PfkQXRG0mqE2+NkcdFOE4fZijV6p4o2C3c M7zy4jIMufwXUMjBlqNd5pbkbyvsKgxefhtw0zktEmrRwlbT1X4U/CxeWhmG6tjM6+fl ybk0g1Wrp79iQCifJ4aWXpX7fAkHlKveccOGSB/9tIyKQoovMsb9+tngEjvNiqbNGSa6 e0LA== X-Forwarded-Encrypted: i=1; AJvYcCWGxauRc6iNBDMkRfvNrLNZq/fRPzimbBP1VfVRQ2X4WakS8sfAB8PfryeagV1rmN5p1XjoOEwvG53oFTmykVAKAYX7whcis2uUZSlL X-Gm-Message-State: AOJu0YzkmyvJ7W/dYQPrqaOOen8g46DZuMQ1OiQdYz2V8T/Odx8ile4C YKrpHSaRmdxEaTgARXYu4ybJJUo74sA661GF2ZNBbMU/I5Xq4ZZQctkMtXMjRQ6vSju4B6veWZV scj4YhK5pWwjrUlwWG+gMF8tLEvjKrgjRSJbFVg== X-Received: by 2002:a25:8e81:0:b0:dc6:b820:bb45 with SMTP id 3f1490d57ef6-dee4f2fe16amr18028910276.27.1715893558734; Thu, 16 May 2024 14:05:58 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240427-realtek-led-v2-0-5abaddc32cf6@gmail.com> <20240427-realtek-led-v2-3-5abaddc32cf6@gmail.com> <20240429063923.648c927f@kernel.org> In-Reply-To: From: Linus Walleij Date: Thu, 16 May 2024 23:05:47 +0200 Message-ID: Subject: Re: [PATCH net-next v2 3/3] net: dsa: realtek: add LED drivers for rtl8366rb To: Luiz Angelo Daros de Luca Cc: Jakub Kicinski , =?UTF-8?Q?Alvin_=C5=A0ipraga?= , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2024 at 7:30=E2=80=AFPM Luiz Angelo Daros de Luca wrote: > > On Sat, 27 Apr 2024 02:11:30 -0300 Luiz Angelo Daros de Luca wrote: > > > +static int rtl8366rb_setup_leds(struct realtek_priv *priv) > > > +{ > > > + struct device_node *leds_np, *led_np; > > > + struct dsa_switch *ds =3D &priv->ds; > > > + struct dsa_port *dp; > > > + int ret =3D 0; > > > + > > > + dsa_switch_for_each_port(dp, ds) { > > > + if (!dp->dn) > > > + continue; > > > + > > > + leds_np =3D of_get_child_by_name(dp->dn, "leds"); > > > + if (!leds_np) { > > > + dev_dbg(priv->dev, "No leds defined for port %d= ", > > > + dp->index); > > > + continue; > > > + } > > > + > > > + for_each_child_of_node(leds_np, led_np) { > > > + ret =3D rtl8366rb_setup_led(priv, dp, > > > + of_fwnode_handle(led_= np)); > > > + if (ret) { > > > + of_node_put(led_np); > > > + break; > > > + } > > > + } > > > + > > > + of_node_put(leds_np); > > > + if (ret) > > > + return ret; > > > + } > > > + return 0; > > > +} > > > > coccicheck generates this warning: > > > > drivers/net/dsa/realtek/rtl8366rb.c:1032:4-15: ERROR: probable double p= ut. > > > > I think it's a false positive. > > Me too. I don't think it is a double put. The put for led_np is called > in the increment code inside the for_each_child_of_node macro. With a > break, we skip that part and we need to put it before leaving. I don't > know coccicheck but maybe it got confused by the double for. Maybe I can use for_each_child_of_node_scoped() and get the handling for free? The checkers should learn about *_scoped now. (I'm still working on the patch, I'm just slow.) Yours, Linus Walleij