Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
20d1278d ddefcd77

+1 -3
+1 -3
drivers/input/misc/sparcspkr.c
··· 182 182 { 183 183 struct sparcspkr_state *state; 184 184 struct bbc_beep_info *info; 185 - struct device_node *dp; 186 185 int err; 187 186 188 187 state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL); ··· 192 193 state->event = bbc_spkr_event; 193 194 spin_lock_init(&state->lock); 194 195 195 - dp = of_find_node_by_path("/"); 196 + struct device_node *dp __free(device_node) = of_find_node_by_path("/"); 196 197 if (!dp) 197 198 return -ENODEV; 198 199 199 200 info = &state->u.bbc; 200 201 info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0); 201 - of_node_put(dp); 202 202 if (!info->clock_freq) 203 203 return -ENODEV; 204 204