linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] video: exynos_dp: fix build warning due to uninitialized value
@ 2012-06-19  6:36 Jingoo Han
  2012-06-20  0:46 ` Florian Tobias Schandinat
  0 siblings, 1 reply; 3+ messages in thread
From: Jingoo Han @ 2012-06-19  6:36 UTC (permalink / raw)
  To: 'Florian Tobias Schandinat'
  Cc: linux-fbdev, linux-kernel, 'Olof Johansson',
	'Jingoo Han'

This patch fixes build warning due to uninitialized value dereference.

drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function [-Wuninitialized]
drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/video/exynos/exynos_dp_core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
index a36b2d2..9b2cdff 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -407,6 +407,8 @@ static unsigned int exynos_dp_get_lane_link_training(
 	case 3:
 		reg = exynos_dp_get_lane3_link_training(dp);
 		break;
+	default:
+		return -EINVAL;
 	}
 
 	return reg;
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] video: exynos_dp: fix build warning due to uninitialized value
  2012-06-19  6:36 [PATCH] video: exynos_dp: fix build warning due to uninitialized value Jingoo Han
@ 2012-06-20  0:46 ` Florian Tobias Schandinat
  2012-06-20  0:54   ` Jingoo Han
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Tobias Schandinat @ 2012-06-20  0:46 UTC (permalink / raw)
  To: Jingoo Han; +Cc: linux-fbdev, linux-kernel, 'Olof Johansson'

Hi Jingoo,

On 06/19/2012 06:36 AM, Jingoo Han wrote:
> This patch fixes build warning due to uninitialized value dereference.
> 
> drivers/video/exynos/exynos_dp_core.c: In function 'exynos_dp_set_link_train':
> drivers/video/exynos/exynos_dp_core.c:529:18: warning: 'reg' may be used uninitialized in this function [-Wuninitialized]
> drivers/video/exynos/exynos_dp_core.c:395:6: note: 'reg' was declared here
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/video/exynos/exynos_dp_core.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
> index a36b2d2..9b2cdff 100644
> --- a/drivers/video/exynos/exynos_dp_core.c
> +++ b/drivers/video/exynos/exynos_dp_core.c
> @@ -407,6 +407,8 @@ static unsigned int exynos_dp_get_lane_link_training(
>  	case 3:
>  		reg = exynos_dp_get_lane3_link_training(dp);
>  		break;
> +	default:
> +		return -EINVAL;

Why do you consider returning -EINVAL here a good idea? As far as I can
see the caller does not check the return value for an error condition
and I doubt that the hardware understands what -EINVAL means. If you
want to fix the warning, make sure that you don't hide actual errors,
add an WARN or BUG or make sure the error code makes it to userspace.

>  	}
>  
>  	return reg;


Best regards,

Florian Tobias Schandinat

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] video: exynos_dp: fix build warning due to uninitialized value
  2012-06-20  0:46 ` Florian Tobias Schandinat
@ 2012-06-20  0:54   ` Jingoo Han
  0 siblings, 0 replies; 3+ messages in thread
From: Jingoo Han @ 2012-06-20  0:54 UTC (permalink / raw)
  To: 'Florian Tobias Schandinat'
  Cc: linux-fbdev, linux-kernel, 'Olof Johansson',
	'Jingoo Han'


On Wed, June 20, 2012 at 9:46 AM, Florian Tobias Schandinat wrote:

> Hi Jingoo,
> 
> On 06/19/2012 06:36 AM, Jingoo Han wrote:
> > This patch fixes build warning due to uninitialized value dereference.
> > @@ -407,6 +407,8 @@ static unsigned int exynos_dp_get_lane_link_training(
> >  	case 3:
> >  		reg = exynos_dp_get_lane3_link_training(dp);
> >  		break;
> > +	default:
> > +		return -EINVAL;
> 
> Why do you consider returning -EINVAL here a good idea? As far as I can
> see the caller does not check the return value for an error condition
> and I doubt that the hardware understands what -EINVAL means. If you
> want to fix the warning, make sure that you don't hide actual errors,
> add an WARN or BUG or make sure the error code makes it to userspace.
> 

OK, I will fix it and send the v2 patch.
Thank you.

Best regards,
Jingoo Han



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-20  0:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19  6:36 [PATCH] video: exynos_dp: fix build warning due to uninitialized value Jingoo Han
2012-06-20  0:46 ` Florian Tobias Schandinat
2012-06-20  0:54   ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).