[PATCH] video: simplefb: modernise DT parsing

Dan Carpenter dan.carpenter at linaro.org
Tue Feb 20 14:21:53 CET 2024


On Fri, Feb 16, 2024 at 06:38:06PM +0000, Caleb Connolly wrote:
> @@ -41,17 +41,25 @@ static int simple_video_probe(struct udevice *dev)
>  
>  	debug("%s: Query resolution...\n", __func__);
>  
> -	uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
> -	uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
> -	uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
> -	if (uc_priv->rot > 3) {
> -		log_debug("%s: invalid rot\n", __func__);
> -		return log_msg_ret("rot", -EINVAL);
> +	ret = ofnode_read_u32(node, "width", &width);
> +	ret = ret ?: ofnode_read_u32(node, "height", &height);
> +	if (ret || !width || !height) {
> +		log_err("%s: invalid width or height: %d\n", __func__, ret);
> +		return ret;

This should be something like:

	return ret ?: -EINVAL;

Perhaps print the width and height in the error message as well.

regards,
dan carpenter


More information about the U-Boot mailing list