You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/11 05:17:59 UTC

[nuttx] branch master updated: drivers/input:Fix setting the number of keyboard driver buffers fails

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

xiaoxiang 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 7dde402982 drivers/input:Fix setting the number of keyboard driver buffers fails
7dde402982 is described below

commit 7dde402982e6401a016593be6cffcc2fcdf8b59a
Author: liuhongchao <li...@xiaomi.com>
AuthorDate: Wed Jul 5 14:31:21 2023 +0800

    drivers/input:Fix setting the number of keyboard driver buffers fails
    
    Buffer nums is not multiplied by the structure size
    
    Signed-off-by: liuhongchao <li...@xiaomi.com>
---
 drivers/input/keyboard_upper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/keyboard_upper.c b/drivers/input/keyboard_upper.c
index 7dfa28bfcb..b1c4a84291 100644
--- a/drivers/input/keyboard_upper.c
+++ b/drivers/input/keyboard_upper.c
@@ -123,7 +123,8 @@ static int keyboard_open(FAR struct file *filep)
 
   /* Initializes the buffer for each open file */
 
-  ret = circbuf_init(&opriv->circ, NULL, upper->nums);
+  ret = circbuf_init(&opriv->circ, NULL,
+                     upper->nums * sizeof(struct keyboard_event_s));
   if (ret < 0)
     {
       kmm_free(opriv);