Skip to content

Commit b9118b7

Browse files
tititiou36davem330
authored andcommitted
ptp: Fix resource leak in case of error
A call to 'ida_simple_remove()' is missing in the error handling path. This as been spotted with the following coccinelle script which tries to detect missing 'ida_simple_remove()' call in error handling paths. /////////////// @@ expression x; identifier l; @@ * x = ida_simple_get(...); ... if (...) { ... } ... if (...) { ... goto l; } ... * l: ... when != ida_simple_remove(...); Signed-off-by: Christophe JAILLET <[email protected]> Acked-by: Richard Cochran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0fd7d43 commit b9118b7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/ptp/ptp_clock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
263263
no_device:
264264
mutex_destroy(&ptp->tsevq_mux);
265265
mutex_destroy(&ptp->pincfg_mux);
266+
ida_simple_remove(&ptp_clocks_map, index);
266267
no_slot:
267268
kfree(ptp);
268269
no_memory:

0 commit comments

Comments
 (0)