[3/6] fbdev: Don't re-validate info->state in fb_ops implementations

Sui Jingfeng 15330273260 at 189.cn
Wed Apr 26 09:49:42 UTC 2023


Tested-by: Sui Jingfeng <suijingfeng at loongson.cn>


On 2023/4/25 22:28, Thomas Zimmermann wrote:
> The file-op entry points fb_read() and fb_write() verify that
> info->state has been set to FBINFO_STATE_RUNNING. Remove the same
> test from the implementations of struct fb_ops.{fb_read,fb_write}.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>
> ---
>   drivers/video/fbdev/core/fb_sys_fops.c | 6 ------
>   drivers/video/fbdev/sm712fb.c          | 6 ------
>   2 files changed, 12 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fb_sys_fops.c b/drivers/video/fbdev/core/fb_sys_fops.c
> index 6589123f4127..7dee5d3c7fb1 100644
> --- a/drivers/video/fbdev/core/fb_sys_fops.c
> +++ b/drivers/video/fbdev/core/fb_sys_fops.c
> @@ -22,9 +22,6 @@ ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count,
>   	unsigned long total_size, c;
>   	ssize_t ret;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
> @@ -64,9 +61,6 @@ ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
>   	unsigned long total_size, c;
>   	size_t ret;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
> diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
> index b528776c7612..6f852cd756c5 100644
> --- a/drivers/video/fbdev/sm712fb.c
> +++ b/drivers/video/fbdev/sm712fb.c
> @@ -1031,9 +1031,6 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf,
>   	if (!info || !info->screen_base)
>   		return -ENODEV;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
> @@ -1097,9 +1094,6 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf,
>   	if (!info || !info->screen_base)
>   		return -ENODEV;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)


More information about the dri-devel mailing list