[Intel-gfx] [PATCH 3/3] drm: Fix shift operations for drm_fb_helper::drm_target_preferred()

Daniel Vetter daniel at ffwll.ch
Mon Nov 28 07:18:27 UTC 2016


On Sun, Nov 27, 2016 at 05:09:10PM +0000, Chris Wilson wrote:
> smatch correctly warns:
> 
> 	drivers/gpu/drm/drm_fb_helper.c:1960 drm_target_preferred() warn: should '1 << i' be a 64 bit type?
> 	drivers/gpu/drm/drm_fb_helper.c:2001 drm_target_preferred() warn: should '1 << i' be a 64 bit type?
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Entire series applied, thx.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 851a7e30444b..3a71a03b14a9 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1945,19 +1945,20 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
>  				 bool *enabled, int width, int height)
>  {
>  	struct drm_fb_helper_connector *fb_helper_conn;
> -	int i;
> -	uint64_t conn_configured = 0, mask;
> +	const u64 mask = BIT_ULL(fb_helper->connector_count) - 1;
> +	u64 conn_configured = 0;
>  	int tile_pass = 0;
> -	mask = (1 << fb_helper->connector_count) - 1;
> +	int i;
> +
>  retry:
>  	drm_fb_helper_for_each_connector(fb_helper, i) {
>  		fb_helper_conn = fb_helper->connector_info[i];
>  
> -		if (conn_configured & (1 << i))
> +		if (conn_configured & BIT_ULL(i))
>  			continue;
>  
>  		if (enabled[i] == false) {
> -			conn_configured |= (1 << i);
> +			conn_configured |= BIT_ULL(i);
>  			continue;
>  		}
>  
> @@ -1998,7 +1999,7 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
>  		}
>  		DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
>  			  "none");
> -		conn_configured |= (1 << i);
> +		conn_configured |= BIT_ULL(i);
>  	}
>  
>  	if ((conn_configured & mask) != mask) {
> -- 
> 2.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list