drivers: stepper: tmc50xx: add a null pointer check

Check if the actual velocity pointer is NULL or not, if its null return
-EINVAL in order to avoid null pointer dereferencing later in code

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
This commit is contained in:
Jilay Pandya 2025-06-02 15:52:40 +02:00 committed by Benjamin Cabé
commit ca2f7254d2

View file

@ -105,6 +105,7 @@ static int tmc50xx_stepper_set_event_callback(const struct device *dev,
static int read_vactual(const struct tmc50xx_stepper_config *config, int32_t *actual_velocity)
{
__ASSERT(actual_velocity != NULL, "actual_velocity pointer must not be NULL");
int err;
err = tmc50xx_read(config->controller, TMC50XX_VACTUAL(config->index), actual_velocity);