From 1e142b000116639432a072ca80ebec13c1866977 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Tue, 5 Nov 2024 21:11:02 +0100 Subject: [PATCH] drivers: stepper: shell: fix null pointer check This commit introduces null pointer check in print_callback Signed-off-by: Jilay Pandya --- drivers/stepper/stepper_shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index 05ad2370382..7483d7af4ab 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -44,6 +44,9 @@ static void print_callback(const struct device *dev, const enum stepper_event ev void *user_data) { const struct shell *sh = user_data; + if (!sh) { + return; + } switch (event) { case STEPPER_EVENT_STEPS_COMPLETED: