Skip to content

Commit 20d1278

Browse files
javiercarrascocruzdtor
authored andcommitted
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 <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent ddefcd7 commit 20d1278

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/input/misc/sparcspkr.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ static int bbc_beep_probe(struct platform_device *op)
182182
{
183183
struct sparcspkr_state *state;
184184
struct bbc_beep_info *info;
185-
struct device_node *dp;
186185
int err;
187186

188187
state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL);
@@ -193,13 +192,12 @@ static int bbc_beep_probe(struct platform_device *op)
193192
state->event = bbc_spkr_event;
194193
spin_lock_init(&state->lock);
195194

196-
dp = of_find_node_by_path("/");
195+
struct device_node *dp __free(device_node) = of_find_node_by_path("/");
197196
if (!dp)
198197
return -ENODEV;
199198

200199
info = &state->u.bbc;
201200
info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0);
202-
of_node_put(dp);
203201
if (!info->clock_freq)
204202
return -ENODEV;
205203

0 commit comments

Comments
 (0)