Skip to content

Commit fcd54cf

Browse files
Emil-Juhldlezcano
authored andcommitted
tools/lib/thermal: Fix sampling handler context ptr
The sampling handler, provided by the user alongside a void* context, was invoked with an internal structure instead of the user context. Correct the invocation of the sampling handler to pass the user context pointer instead. Note that the approach taken is similar to that in events.c, and will reduce the chances of this mistake happening if additional sampling callbacks are added. Fixes: 47c4b0d ("tools/lib/thermal: Add a thermal library") Signed-off-by: Emil Dahl Juhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent f16beaa commit fcd54cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/lib/thermal/sampling.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ static int handle_thermal_sample(struct nl_msg *n, void *arg)
1616
struct thermal_handler_param *thp = arg;
1717
struct thermal_handler *th = thp->th;
1818

19+
arg = thp->arg;
20+
1921
genlmsg_parse(nlh, 0, attrs, THERMAL_GENL_ATTR_MAX, NULL);
2022

2123
switch (genlhdr->cmd) {

0 commit comments

Comments
 (0)