From 9cfe255a81a15c21e8914c13934b31c0b571854f Mon Sep 17 00:00:00 2001 From: Alan Carvalho de Assis Date: Thu, 27 Jun 2024 17:58:19 -0300 Subject: [PATCH] Fix allocated memory test Signed-off-by: Alan C. Assis --- drivers/motor/a4988.c | 2 +- drivers/motor/drv8825.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/motor/a4988.c b/drivers/motor/a4988.c index 21f96fa631..dbe1017afd 100644 --- a/drivers/motor/a4988.c +++ b/drivers/motor/a4988.c @@ -284,7 +284,7 @@ int a4988_register(FAR const char *devpath, FAR struct a4988_ops_s *ops) priv->ops = ops; lower = kmm_malloc(sizeof(struct stepper_lowerhalf_s)); - if (priv == NULL) + if (lower == NULL) { stperr("Failed to allocate instance\n"); kmm_free(priv); diff --git a/drivers/motor/drv8825.c b/drivers/motor/drv8825.c index d1fde92aef..1b45af0b13 100644 --- a/drivers/motor/drv8825.c +++ b/drivers/motor/drv8825.c @@ -314,7 +314,7 @@ int drv8825_register(FAR const char *devpath, FAR struct drv8825_ops_s *ops) priv->ops = ops; lower = kmm_malloc(sizeof(struct stepper_lowerhalf_s)); - if (priv == NULL) + if (lower == NULL) { stperr("Failed to allocate instance\n"); kmm_free(priv);