diff options
author | 2024-10-21 22:28:24 +0200 | |
---|---|---|
committer | 2024-10-22 13:58:39 -0700 | |
commit | 20d1278d4bb5fbb7021314c573c69d8fa3e33de1 (patch) | |
tree | 389321f6a9ef07f27d6591493a6f158e09d00926 | |
parent | Input: sparcspkr - use device managed memory for 'state' (diff) | |
download | wireguard-linux-20d1278d4bb5fbb7021314c573c69d8fa3e33de1.tar.xz wireguard-linux-20d1278d4bb5fbb7021314c573c69d8fa3e33de1.zip |
Input: sparcspkr - use cleanup facility for device_node
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>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20241021-input_automate_of_node_put-v3-2-cc73f636e1bc@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/misc/sparcspkr.c | 4 |
1 files changed, 1 insertions, 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; |