Re: [PATCH v2 01/24] backlight: Silently fail backlight_update_status() if no device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 23, 2020 at 12:45:09PM +0200, Sam Ravnborg wrote:
> backlight_update_status() may be called from code that does not have
> any valid backlight device. To avoid ifdeffery and too much conditionals
> silently fail if the backlight_device is NULL.
> 
> Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: Lee Jones <lee.jones@xxxxxxxxxx>
> Cc: Daniel Thompson <daniel.thompson@xxxxxxxxxx>
> Cc: Jingoo Han <jingoohan1@xxxxxxxxx>

Reviewed-by: Daniel Thompson <daniel.thompson@xxxxxxxxxx>


> ---
>  include/linux/backlight.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index 614653e07e3a..190963ffb7fc 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -348,6 +348,9 @@ static inline int backlight_update_status(struct backlight_device *bd)
>  {
>  	int ret = -ENOENT;
>  
> +	if (!bd)
> +		return 0;
> +
>  	mutex_lock(&bd->update_lock);
>  	if (bd->ops && bd->ops->update_status)
>  		ret = bd->ops->update_status(bd);
> -- 
> 2.25.1
> 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux