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:
parent
28be2211f4
commit
ca2f7254d2
1 changed files with 1 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue