From patchwork Tue Oct 8 16:10:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13826680 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 F0C891E00B1; Tue, 8 Oct 2024 16:10:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403838; cv=none; b=kHXyflo/ongw1fEVCqphwPZMsWg13L7rfVy8SRgxpLEHmLHYtKW7NfxZ6wlkLcVlT544KIUUV1jPP9yNstZNE48oIa869P3FtldRLvMrUuff9EpulOr+7CTxn8J3rGx7h0JmJ/Nr1k8JWZyPjoI7h7nlI1xxg3qgWfjp+ne87jA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403838; c=relaxed/simple; bh=q5vUQZfbwy6fRP5D3eyH3Zp44IozpqyYJHBzw+URkbY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Sc9aksXKBwVah8Cl4BomkdpES7kKNXjNbWBpAmSAtvdEQT2V0c21X/QqyYZ+5Csa16pZU0eXVae9Uh1xCu/+re9Enc7vqlv7Hmyq4VHVjLY4SpRjrYT+dtGlxH8N5igtbf3Ifa4C8YsOZV0Y+6FyPDutf+YgCHNYKwi194nOD8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iJjeFNf9; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iJjeFNf9" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42ca4e0299eso52355515e9.2; Tue, 08 Oct 2024 09:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728403835; x=1729008635; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dr6wb9TLKZZRAzr/ix7ApfkEMcDHa3kPnrh21DGwKY0=; b=iJjeFNf9IZXZsaQsEJ11lmf4J2x7RJQGra/+UuZn4i04CU79YPyESduAjJBM58mUIr qONPzsCQF1jeb+JupaIdyTekua2uLe/L5mf9mBJ+M6XkvcAHJ+YtIFFNTzVDDQWCeUtq jlxLwYby0EIPiyzS5w9TCvWcr+NeNarkuu6n763Rp7prJmUywWVWvC1zhrNecqzj6B2Z 3C+nNEvEDDVe2dlwPLNFSFQhyUr+bxMYO1KC/e3pRyVCBaRAmCQeg605FKBu7UL3uTdg P4iF5XnsBoDBeI/jlPGIl91dMH6flheCEMyNBARkodeEy8qU0DhSm5WmQqZsactz4aj2 1Kew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728403835; x=1729008635; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dr6wb9TLKZZRAzr/ix7ApfkEMcDHa3kPnrh21DGwKY0=; b=Ys1ZYlPRky8bY+DQXypj05+fymTuT6vETsI9D7bWKPYHEjgCjcMzSdsTO2BTvykBdF 9/YixKbwj4Zb5rL5iLyZNrnIqDneJGLIzzZacdusdRtYt5+K1Ejdp/endTGdqytp1hHu 0Eo30t7v8h2scLfwyxd5n+4dIvchdVAfEmFdZJV1+Etqog/E5OBOUBUlm41HMLL22ZB4 6ie2Y74kMgcPl7Veu9JtTRwrTyVyMM4OKJ/s1E+M62V19Klf4YpZOX0lokTmq41YHH4l uyTVVisSATTHa7ZCVG5MFvqVLfm133nKn2KYVWC+VaPyUOSXd9/3reoN2gtARoerF2+L mRdw== X-Forwarded-Encrypted: i=1; AJvYcCWhHGTWDrv79xVNA0+ToSXm7IeyxXTWR8CENSraZ/MulzUFrkv9S87NKkBF9wOcPV4FFT4+XYDa@vger.kernel.org, AJvYcCXR42Dpe7dLPQoQlsMIbTtlcOwTPk0/Tq1YOCUMnUihP2EgF4zgaohfgwt4wlFfkX8jkZuxbQZGOHc7n/Q=@vger.kernel.org X-Gm-Message-State: AOJu0YxccTaLdGzbsO3yDFWEeDmXP1zXJpMlJo9NjAQB1kY9JSDnWGBd QFdl9R0EtEXCBCjojbK5sdcBPFz2WyEfaq6hyiK4k6H3raDyflsYu0d3na8q X-Google-Smtp-Source: AGHT+IF2odc1Ix7mWrUlJdgxfmoJRjWJRyk4eIzdmT15VsckyY3Xh34gSdt13mk6BPONgCaallmTYw== X-Received: by 2002:a05:600c:5111:b0:42c:a802:a8cd with SMTP id 5b1f17b1804b1-42f85ab5dc1mr119111795e9.11.1728403834767; Tue, 08 Oct 2024 09:10:34 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-f2f2-fc2e-cc91-5c72.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:f2f2:fc2e:cc91:5c72]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f89ec71aesm113505385e9.33.2024.10.08.09.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:10:34 -0700 (PDT) From: Javier Carrasco Date: Tue, 08 Oct 2024 18:10:27 +0200 Subject: [PATCH net-next 1/3] device property: Introduce fwnode_for_each_available_child_node_scoped() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241008-mv88e6xxx_leds_fwnode_put-v1-1-cfd7758cd176@gmail.com> References: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com> In-Reply-To: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Linus Walleij Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728403830; l=1183; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=q5vUQZfbwy6fRP5D3eyH3Zp44IozpqyYJHBzw+URkbY=; b=F0T9Rl8gnijwBYmpOUjkTZW6Qpy2HjLQPqMBRKW2jY5vTX0cm1TaLz0xgA7QpIpnveTv0GnwZ YsXJ7vwJTTOAAHwfqkzaEcLE8fiKShk2NHQVF79Nh/d52C3vOMOxt/s X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-Patchwork-Delegate: kuba@kernel.org Introduce the scoped variant of the fwnode_for_each_available_child_node() to automatically decrement the child's refcount when it goes out of scope, removing the need for explicit calls to fwnode_handle_put(). Signed-off-by: Javier Carrasco Reviewed-by: Andy Shevchenko --- include/linux/property.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/property.h b/include/linux/property.h index 61fc20e5f81f..b37508ecf606 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -168,6 +168,11 @@ struct fwnode_handle *fwnode_get_next_available_child_node( for (child = fwnode_get_next_available_child_node(fwnode, NULL); child;\ child = fwnode_get_next_available_child_node(fwnode, child)) +#define fwnode_for_each_available_child_node_scoped(fwnode, child) \ + for (struct fwnode_handle *child __free(fwnode_handle) = \ + fwnode_get_next_available_child_node(fwnode, NULL); child; \ + child = fwnode_get_next_available_child_node(fwnode, child)) + struct fwnode_handle *device_get_next_child_node(const struct device *dev, struct fwnode_handle *child); From patchwork Tue Oct 8 16:10:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13826681 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 C84351E0DEA; Tue, 8 Oct 2024 16:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403840; cv=none; b=hnA+B741Z6RXeGbM/Uwz4y+nuAstqCBptrblq1+UOsPJGGUugo6IERL7bQ39YkzCXfKyJ4iVdrvpKYsBRoY5YpVp/t+xSA99sAcsI8Y+JUqCWP+mcWv1loKVYSbUbYDsIYCtz6+HdROka45fPFjhtcqBuJLQF0ES/E9ye8qTajw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403840; c=relaxed/simple; bh=xknXWVgHUiP3UwPIEh3pOMCmZWbQWHfRLuGBmeS3A6Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CCFL+6FczR1OFJicmnjYuUTktkLcLhjHpEgx6HbcEriTk3x65btN7vJa8W+yNXD6r1Px4HWasUOaUCjw5Gb3SIWh3nx/qrXYWD0MGau3SB0NzoG80d0vRqYlAMKB6AnESKbjiw7dDw0RmdNzRaqViUoLYL5hAHO/y2/66YMb75Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m6DMjVqp; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m6DMjVqp" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so59328515e9.3; Tue, 08 Oct 2024 09:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728403837; x=1729008637; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cc8Y7IUGEGue3Fw8DnBSs9hs1PN8j5lXcmjkKcBNrs0=; b=m6DMjVqpZkVJCU+SWJJg7RhL8AOvIicMS79qujngOtDfeXX7aK+vX6Uj3MfiEL5ZGS +tAC3PK13eOE/3YbetYJgfxDKZklqEs/c3etwylzTFwDlB4GMTKblMMLgPGhCSFaUfUB FK0cctogfbrY0HXWy41KTzmE0MQ7Y8s/tpBUzENdf/qGVoz/ZE/zBpN1s5trstk9kqrp 9fuDnJ8Qdz7HY5bwdTyQZnMlG7lLiaZrXwtRT15nVe9Y+A/lmnhkgWpmgK/clwHWqyNt 4j6lTR4d/lAcku2meutKK4WlG5YnrJ3qoP0jgtPNvfPZuXmih2gNyzK6s9OlS6FvtXsS e9nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728403837; x=1729008637; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cc8Y7IUGEGue3Fw8DnBSs9hs1PN8j5lXcmjkKcBNrs0=; b=ofXtSG0WsalukM+yCvhX1B3BZp2ixDKgQTHpWdWIovrzjpLBEqv4tuP1VOupkneoWb gDlQ/ZSkSL/XVGJFso2mIJISRUPrc+Gg/tKgG1HWdYaH8V1Erfbe1YUoOV1gAddtt9Na dMFSNo8jWuHQysWKun4awHducH7hqFdVSlvGl6B32S1cGX1Lin7eFGJMLlkRbRmQwaiD Vv9UXYEx17EPi3ytaF+wcRCvh1SmxVSWpL76dpZ+ogQtnbaKHJLRMSaHK+USxTj12FzB rtsC9Q1Ypio3yNOwdoEfbwF9E2zm9fecAa/BUJc/fsiC/ea29H3wHYmLF4edX610yEvi D9Zg== X-Forwarded-Encrypted: i=1; AJvYcCV0KPxaOTOP/S+/NECrcZMP50f1xvpYrCc03UD0CSZmpSAUUh2G2kksH0SZDPS0+R2l4PXkhOCQB2gIUqs=@vger.kernel.org, AJvYcCXct8TeH8gM5Mj90uFyk8RFN19ZwdHseght0bAOfoUyl4VB1x9X6a8q7HzBWIjjLJnJKC+OfXKN@vger.kernel.org X-Gm-Message-State: AOJu0YzaIiAUSkT85jU1o5qsKFO8K7nRLCXTTcMhZN1h00P0s4yNBY6R i81Gbiz0U3Bd5MVhMz9So3Z4/YqRsZ861zY8yqFG/ixcG1/M0QBYRZehiucM X-Google-Smtp-Source: AGHT+IFDor3IhK8a0JllZQQdw53ciY8fBFQ5Wr7AJbRlHGZl7OPY6Bic4WKwrN1P+M9g7iMYUqtcTQ== X-Received: by 2002:a05:600c:34d4:b0:42c:b7e2:3bc3 with SMTP id 5b1f17b1804b1-42f85ab9ec2mr125079315e9.19.1728403836597; Tue, 08 Oct 2024 09:10:36 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-f2f2-fc2e-cc91-5c72.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:f2f2:fc2e:cc91:5c72]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f89ec71aesm113505385e9.33.2024.10.08.09.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:10:36 -0700 (PDT) From: Javier Carrasco Date: Tue, 08 Oct 2024 18:10:28 +0200 Subject: [PATCH net-next 2/3] net: dsa: mv88e6xxx: leds: fix led refcount in error path Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241008-mv88e6xxx_leds_fwnode_put-v1-2-cfd7758cd176@gmail.com> References: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com> In-Reply-To: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Linus Walleij Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728403830; l=1687; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=xknXWVgHUiP3UwPIEh3pOMCmZWbQWHfRLuGBmeS3A6Y=; b=ijV2P+sGp6JXwfvJ1JMJGMA51s9J1rGHUihsBW00i23qyPP93epMJG/vxA4rYLYIlLgsEMiju iLF51WudXTPAkBLVT0Nsc5yEYwakW6sEJ0LcYY5RnCEZZiSEBwRB20n X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-Patchwork-Delegate: kuba@kernel.org The 'led' fwnode_handle within fwnode_for_each_child_node() must be released upon early exits by means of an explicit call to fwnode_handle_put(), which in this case is missing. Instead of adding the missing call, and considering that this driver was recently introduced, use a scoped variant of the loop to automatically decrement the child's refcount when it goes out of scope. Note that the _avaialable_ version of the loop has been used, as there is no apparent reason to walk over unavailable nodes. Fixes: 94a2a84f5e9e ("net: dsa: mv88e6xxx: Support LED control") Signed-off-by: Javier Carrasco Reviewed-by: Andrew Lunn --- drivers/net/dsa/mv88e6xxx/leds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/leds.c b/drivers/net/dsa/mv88e6xxx/leds.c index 1c88bfaea46b..92a57552beda 100644 --- a/drivers/net/dsa/mv88e6xxx/leds.c +++ b/drivers/net/dsa/mv88e6xxx/leds.c @@ -744,7 +744,7 @@ mv88e6xxx_led1_hw_control_get_device(struct led_classdev *ldev) int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port) { - struct fwnode_handle *led = NULL, *leds = NULL; + struct fwnode_handle *leds = NULL; struct led_init_data init_data = { }; enum led_default_state state; struct mv88e6xxx_port *p; @@ -770,7 +770,7 @@ int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port) return 0; } - fwnode_for_each_child_node(leds, led) { + fwnode_for_each_available_child_node_scoped(leds, led) { /* Reg represent the led number of the port, max 2 * LEDs can be connected to each port, in some designs * only one LED is connected. From patchwork Tue Oct 8 16:10:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13826682 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 C41131E0E1B; Tue, 8 Oct 2024 16:10:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403842; cv=none; b=fVL2+XWmd3mOtUPe2mRCpYO8qB64LjVk8xzX5tQVDGpwHWJCxGzzSjyiMBbeUj/zT1g/RGdc3bpuUL29HDYgJv0RrK7aVbE2gqa2UZcYAWFrbLgOerG1w74E2jahb2tebItMGlrZdA1ql0sS+ceadCDeLGU/CzWFqYmjm+MM/bs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403842; c=relaxed/simple; bh=cWyudSNwMdAoPLDHpxMU3t/7IYAcpd1uRUv+IKIqdyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AShsH8pzkf7V9QbEVsTJwD/OX3PItNfY3welWbu19ogPuwxZQ8DC1j7JfOInKGJQl6Z3lMPhKpIm2ad6kiDAAlHAowlvWjbc414Ia5lkca31L82/C2SfRFPYGC8OYFi8rd1M9X8VyQhPQZqYyddst913M2I+KePIu2KpO2P9uck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Pstc5aoK; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Pstc5aoK" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43056d99a5aso3826295e9.0; Tue, 08 Oct 2024 09:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728403839; x=1729008639; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MKEcyPzV2K4r+AP5/PHCK58XwhBSe6yI2S077zk0qgU=; b=Pstc5aoKtRGP5YQVeCVZXRokGeOGMS/l3LyMRI/eO4bsf0bY9gCAaQ3EoHi++xiSxK CBNxO6DNFxfymE9bSZiSpD441+QkImA9WMSf4OJMdTgwTZi2xJzNI5k/WpK50to3+WcC OeBZyJOEYhW/ubqOoIt/xJ8nAteNyz/vpNTgSDTHazS0+JOU9ReiPNCdDcn9gC1Lzf9o DaBpI4/lBMTSap6axxBUAQCZVD8aIF/TZYMGmy6kIS1j/znCOa3AAvF+IuAQWMBnBieS 2QWIRpHlo8jYmsMPk50o7uFjz6DB7AUMOMP2uuA3lKuUUISV1N+HgVYbwwP/Oi7qmhvn V74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728403839; x=1729008639; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MKEcyPzV2K4r+AP5/PHCK58XwhBSe6yI2S077zk0qgU=; b=SwnzQgNQG3DFTKkDc2SRbNel+A26N2TikqCHJP8wvLEPe/eiWqb4WFBuvQaO81Av3R 0SxkOPFoSx7pZoUmFkcJWYLyhHxpObIeJb55+YtUpp0ex7yi31YzmABbipqsTX5AsuFL mEbAx9VuCfOtJbXzqcURTVZXQouPm4ntJD9YVw0OJi5cGYsdSOxuZ7mKDTXypQ1URTdE 0RwUiNsL1yZx9VzukBJ4UEJahGMuL17aPU5JKQZQyK4EDTVl56a+/hC3jNBrHj4VXYYq RJnZesnp0VlL5gpJ8ADYCu9hFto+t/hgQbsOWiep/L5AKJ5Z4T1q/75nWdWUhJDw5kYG Ws7Q== X-Forwarded-Encrypted: i=1; AJvYcCUUeK7aqdjeRba8brnv/UoX1mvY8gFvIT5FMsG2/CzId61c/jVUq5BDT8ERN3ZVRjbwceeDxJeE@vger.kernel.org, AJvYcCWATiFvDrMh70BkSAUZ6WzBd5kpS7CMFM+IQhtsssAx78PDvfN/Pi75EjDmAZb0Zso3yNs5JnRCE0NzBbU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx13XYKkbm7pN1v16MqJpVxqVvIn2I4L2aMsCW1LqUVmKnpzfAA 2nvIDxkUH+sdauMgM+Qg0E66nEu6r/16PZg6J+dnrONuaLhn04BtZPS+Uoyy X-Google-Smtp-Source: AGHT+IGNjyCJTmyTOfXgVwWxpuw+hFn0QXE40kSv7Ekdba6rn3qd+huk2emCJAp/YE7300IIDQiy5w== X-Received: by 2002:a05:600c:4748:b0:426:64c1:8388 with SMTP id 5b1f17b1804b1-43057b96e01mr4863305e9.17.1728403838405; Tue, 08 Oct 2024 09:10:38 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-f2f2-fc2e-cc91-5c72.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:f2f2:fc2e:cc91:5c72]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f89ec71aesm113505385e9.33.2024.10.08.09.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:10:37 -0700 (PDT) From: Javier Carrasco Date: Tue, 08 Oct 2024 18:10:29 +0200 Subject: [PATCH net-next 3/3] net: dsa: mv88e6xxx: leds: fix leds refcount Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241008-mv88e6xxx_leds_fwnode_put-v1-3-cfd7758cd176@gmail.com> References: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com> In-Reply-To: <20241008-mv88e6xxx_leds_fwnode_put-v1-0-cfd7758cd176@gmail.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Linus Walleij Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1728403830; l=1498; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=cWyudSNwMdAoPLDHpxMU3t/7IYAcpd1uRUv+IKIqdyE=; b=R+xeU5F94QPGHpYg+aR9IRcr5vI7nx8crw+ihr1x9cAGGvKTllbNcIVDyIuV/1uGByQv5Zu1N KB5AHretsNrCiMl+l8E2WSCN30YHNBCwKUZd/kJg+/TMoKi5/vrZTbP X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-Patchwork-Delegate: kuba@kernel.org The 'leds' fwnode_handle is initialized by calling fwnode_get_named_child_node(), which requires an explicit call to fwnode_handle_put() when the node is not required anymore. Instead of adding the missing call, and considering that this driver was recently introduced, use the automatic clenaup mechanism to release the node when it goes out of scope. Fixes: 94a2a84f5e9e ("net: dsa: mv88e6xxx: Support LED control") Signed-off-by: Javier Carrasco --- drivers/net/dsa/mv88e6xxx/leds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/leds.c b/drivers/net/dsa/mv88e6xxx/leds.c index 92a57552beda..b9959e1f3c9e 100644 --- a/drivers/net/dsa/mv88e6xxx/leds.c +++ b/drivers/net/dsa/mv88e6xxx/leds.c @@ -744,7 +744,6 @@ mv88e6xxx_led1_hw_control_get_device(struct led_classdev *ldev) int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port) { - struct fwnode_handle *leds = NULL; struct led_init_data init_data = { }; enum led_default_state state; struct mv88e6xxx_port *p; @@ -763,7 +762,8 @@ int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port) dev = chip->dev; - leds = fwnode_get_named_child_node(p->fwnode, "leds"); + struct fwnode_handle *leds __free(fwnode_handle) = + fwnode_get_named_child_node(p->fwnode, "leds"); if (!leds) { dev_dbg(dev, "No Leds node specified in device tree for port %d!\n", port);