jlaitine commented on code in PR #8000: URL: https://github.com/apache/nuttx/pull/8000#discussion_r1060043819
########## drivers/video/fb.c: ########## @@ -682,6 +675,30 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg) return ret; } +static int fb_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map) +{ + FAR struct inode *inode; + FAR struct fb_chardev_s *fb; + int ret = -EINVAL; + + /* Get the framebuffer instance */ + + DEBUGASSERT(filep != NULL && filep->f_inode != NULL); + inode = filep->f_inode; + fb = (FAR struct fb_chardev_s *)inode->i_private; + + /* Return the address corresponding to the start of frame buffer. */ + + if (fb && map && + (size_t)map->offset + map->length < fb->fblen) Review Comment: thanks for noticing < vs <= . silly bug well yes. although off_t and size_t are not strictly the same type even though they are of same sign... I'll remove the cast. done ########## drivers/video/fb.c: ########## @@ -682,6 +675,30 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg) return ret; } +static int fb_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map) +{ + FAR struct inode *inode; + FAR struct fb_chardev_s *fb; + int ret = -EINVAL; + + /* Get the framebuffer instance */ + + DEBUGASSERT(filep != NULL && filep->f_inode != NULL); + inode = filep->f_inode; + fb = (FAR struct fb_chardev_s *)inode->i_private; + + /* Return the address corresponding to the start of frame buffer. */ + + if (fb && map && + (size_t)map->offset + map->length < fb->fblen) + { + map->vaddr = (char *)fb->fbmem + map->offset; Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org