Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575315 > unrolled thread

[PATCH] drm/rockchip: cdn-dp: fix cdn-dp complie warning

Started byMark Yao <mark.yao@rock-chips.com>
First post2017-02-07 02:40 +0100
Last post2017-02-07 17:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/rockchip: cdn-dp: fix cdn-dp complie warning Mark Yao <mark.yao@rock-chips.com> - 2017-02-07 02:40 +0100
    Re: [PATCH] drm/rockchip: cdn-dp: fix cdn-dp complie warning Sean Paul <seanpaul@chromium.org> - 2017-02-07 17:10 +0100

#1575315 — [PATCH] drm/rockchip: cdn-dp: fix cdn-dp complie warning

FromMark Yao <mark.yao@rock-chips.com>
Date2017-02-07 02:40 +0100
Subject[PATCH] drm/rockchip: cdn-dp: fix cdn-dp complie warning
Message-ID<t82Vc-4qF-17@gated-at.bofh.it>
fix warning:

drivers/gpu/drm/rockchip/cdn-dp-reg.c:632:24: warning:
  'val[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
  msa_misc = 2 * val[0] + 32 * val[1] +

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
---
 drivers/gpu/drm/rockchip/cdn-dp-reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-reg.c b/drivers/gpu/drm/rockchip/cdn-dp-reg.c
index 3a5b8a4..319dbba 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-reg.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-reg.c
@@ -592,7 +592,7 @@ static int cdn_dp_get_msa_misc(struct video_info *video,
 			       struct drm_display_mode *mode)
 {
 	u32 msa_misc;
-	u8 val[2];
+	u8 val[2] = {0};
 
 	switch (video->color_fmt) {
 	case PXL_RGB:
-- 
1.9.1

[toc] | [next] | [standalone]


#1575831

FromSean Paul <seanpaul@chromium.org>
Date2017-02-07 17:10 +0100
Message-ID<t8gv8-56A-9@gated-at.bofh.it>
In reply to#1575315
On Tue, Feb 07, 2017 at 09:34:01AM +0800, Mark Yao wrote:
> fix warning:
> 
> drivers/gpu/drm/rockchip/cdn-dp-reg.c:632:24: warning:
>   'val[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   msa_misc = 2 * val[0] + 32 * val[1] +
> 
> Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
> ---
>  drivers/gpu/drm/rockchip/cdn-dp-reg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-reg.c b/drivers/gpu/drm/rockchip/cdn-dp-reg.c
> index 3a5b8a4..319dbba 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-reg.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-reg.c
> @@ -592,7 +592,7 @@ static int cdn_dp_get_msa_misc(struct video_info *video,
>  			       struct drm_display_mode *mode)
>  {
>  	u32 msa_misc;
> -	u8 val[2];
> +	u8 val[2] = {0};

Kind of a nit, but it would be better to add default cases to the switches below so it's more
obvious which format/depth you consider the fallback.

Sean

>  
>  	switch (video->color_fmt) {
>  	case PXL_RGB:
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web