From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Hans de Goede <hdegoede@redhat.com>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev,
linux-rpi-kernel@lists.infradead.org,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH v3 2/2] Input: sparcspkr - use cleanup facility for device_node
Date: Mon, 21 Oct 2024 22:28:24 +0200 [thread overview]
Message-ID: <20241021-input_automate_of_node_put-v3-2-cc73f636e1bc@gmail.com> (raw)
In-Reply-To: <20241021-input_automate_of_node_put-v3-0-cc73f636e1bc@gmail.com>
Use the 'free(device_node)' macro to simplify the code by automatically
freeing the device node, which removes the need for explicit calls to
'of_node_put()'.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/input/misc/sparcspkr.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index e484d79b5597..8d7303fc13bc 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -182,7 +182,6 @@ static int bbc_beep_probe(struct platform_device *op)
{
struct sparcspkr_state *state;
struct bbc_beep_info *info;
- struct device_node *dp;
int err;
state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL);
@@ -193,13 +192,12 @@ static int bbc_beep_probe(struct platform_device *op)
state->event = bbc_spkr_event;
spin_lock_init(&state->lock);
- dp = of_find_node_by_path("/");
+ struct device_node *dp __free(device_node) = of_find_node_by_path("/");
if (!dp)
return -ENODEV;
info = &state->u.bbc;
info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0);
- of_node_put(dp);
if (!info->clock_freq)
return -ENODEV;
--
2.43.0
next prev parent reply other threads:[~2024-10-21 20:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 20:28 [PATCH v3 0/2] input: automate of_node_put() calls for device_node Javier Carrasco
2024-10-21 20:28 ` [PATCH v3 1/2] Input: sparcspkr - use device managed memory for 'state' Javier Carrasco
2024-10-21 20:28 ` Javier Carrasco [this message]
2024-10-22 4:57 ` [PATCH v3 2/2] Input: sparcspkr - use cleanup facility for device_node Chen-Yu Tsai
2024-10-22 20:59 ` [PATCH v3 0/2] input: automate of_node_put() calls " Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241021-input_automate_of_node_put-v3-2-cc73f636e1bc@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dmitry.torokhov@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=hdegoede@redhat.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=matthias.bgg@gmail.com \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).