summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Dahl Juhl <emdj@bang-olufsen.dk>2024-10-15 19:18:26 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2024-11-04 15:38:29 +0100
commitfcd54cf480c87b96313a97dbf898c644b7bb3a2e (patch)
treecf059a54788afb533c4bb07eb10516fda9b6ece2
parentthermal/drivers/qcom/lmh: Remove false lockdep backtrace (diff)
downloadlinux-fcd54cf480c87b96313a97dbf898c644b7bb3a2e.tar.xz
linux-fcd54cf480c87b96313a97dbf898c644b7bb3a2e.zip
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: 47c4b0de080a ("tools/lib/thermal: Add a thermal library") Signed-off-by: Emil Dahl Juhl <emdj@bang-olufsen.dk> Link: https://lore.kernel.org/r/20241015171826.170154-1-emdj@bang-olufsen.dk Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--tools/lib/thermal/sampling.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/lib/thermal/sampling.c b/tools/lib/thermal/sampling.c
index 70577423a9f0..f67c1f9ea1d7 100644
--- a/tools/lib/thermal/sampling.c
+++ b/tools/lib/thermal/sampling.c
@@ -16,6 +16,8 @@ static int handle_thermal_sample(struct nl_msg *n, void *arg)
struct thermal_handler_param *thp = arg;
struct thermal_handler *th = thp->th;
+ arg = thp->arg;
+
genlmsg_parse(nlh, 0, attrs, THERMAL_GENL_ATTR_MAX, NULL);
switch (genlhdr->cmd) {