This is an automated email from the ASF dual-hosted git repository.

raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cfe255a81 Fix allocated memory test
9cfe255a81 is described below

commit 9cfe255a81a15c21e8914c13934b31c0b571854f
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Thu Jun 27 17:58:19 2024 -0300

    Fix allocated memory test
    
    Signed-off-by: Alan C. Assis <[email protected]>
---
 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);

Reply via email to