All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
@ 2016-05-11 12:49 ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-05-11 12:49 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Arnd Bergmann, Kukjin Kim, Krzysztof Kozlowski,
	Sylwester Nawrocki, Marek Szyprowski, linux-kernel,
	linux-arm-kernel, linux-samsung-soc

A rework of the exynos-mipi-video driver caused a warning
about the new __set_phy_state function potentially accessing
a variable before its initialization:

drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return val & data->resetn_val;
         ~~~~^~~~~~~~~~~~~~~~~~
drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
  u32 val;

The failure scenario here is the offset passed into a the
stub regmap_read() function that does not modify its output,
however regmap_read() can also fail for other reasons, so
adding error handling (in this case, returning zero from
is_running) seems the best solution.

Note that this warning showed up with the ARM s5pv210_defconfig,
indicating that we most likely want to either enable CONFIG_REGMAP
in that defconfig as well, or disable the phy-exynos-mipi-video
driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
---
 drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
index cc093ebfda94..8b851f718123 100644
--- a/drivers/phy/phy-exynos-mipi-video.c
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
 			struct exynos_mipi_video_phy *state)
 {
 	u32 val;
+	int ret;
+
+	ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
+	if (ret)
+		return 0;
 
-	regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
 	return val & data->resetn_val;
 }
 
-- 
2.7.0

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

* [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
@ 2016-05-11 12:49 ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-05-11 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

A rework of the exynos-mipi-video driver caused a warning
about the new __set_phy_state function potentially accessing
a variable before its initialization:

drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return val & data->resetn_val;
         ~~~~^~~~~~~~~~~~~~~~~~
drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
  u32 val;

The failure scenario here is the offset passed into a the
stub regmap_read() function that does not modify its output,
however regmap_read() can also fail for other reasons, so
adding error handling (in this case, returning zero from
is_running) seems the best solution.

Note that this warning showed up with the ARM s5pv210_defconfig,
indicating that we most likely want to either enable CONFIG_REGMAP
in that defconfig as well, or disable the phy-exynos-mipi-video
driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
---
 drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
index cc093ebfda94..8b851f718123 100644
--- a/drivers/phy/phy-exynos-mipi-video.c
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
 			struct exynos_mipi_video_phy *state)
 {
 	u32 val;
+	int ret;
+
+	ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
+	if (ret)
+		return 0;
 
-	regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
 	return val & data->resetn_val;
 }
 
-- 
2.7.0

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

* Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
  2016-05-11 12:49 ` Arnd Bergmann
@ 2016-05-11 18:51   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2016-05-11 18:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Kishon Vijay Abraham I, Kukjin Kim, Krzysztof Kozlowski,
	Sylwester Nawrocki, Marek Szyprowski, linux-kernel,
	linux-arm-kernel, linux-samsung-soc

On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
> A rework of the exynos-mipi-video driver caused a warning
> about the new __set_phy_state function potentially accessing
> a variable before its initialization:
> 
> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   return val & data->resetn_val;
>          ~~~~^~~~~~~~~~~~~~~~~~
> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>   u32 val;
> 
> The failure scenario here is the offset passed into a the
> stub regmap_read() function that does not modify its output,
> however regmap_read() can also fail for other reasons, so
> adding error handling (in this case, returning zero from
> is_running) seems the best solution.
> 
> Note that this warning showed up with the ARM s5pv210_defconfig,
> indicating that we most likely want to either enable CONFIG_REGMAP
> in that defconfig as well, or disable the phy-exynos-mipi-video
> driver.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
> ---
>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
> index cc093ebfda94..8b851f718123 100644
> --- a/drivers/phy/phy-exynos-mipi-video.c
> +++ b/drivers/phy/phy-exynos-mipi-video.c
> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>  			struct exynos_mipi_video_phy *state)
>  {
>  	u32 val;

Other way would be to initialize val=0 since there is no real error code
returned. Anyway:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

> +	int ret;
> +
> +	ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
> +	if (ret)
> +		return 0;
>  
> -	regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
>  	return val & data->resetn_val;
>  }
>  
> -- 
> 2.7.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
@ 2016-05-11 18:51   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2016-05-11 18:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
> A rework of the exynos-mipi-video driver caused a warning
> about the new __set_phy_state function potentially accessing
> a variable before its initialization:
> 
> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   return val & data->resetn_val;
>          ~~~~^~~~~~~~~~~~~~~~~~
> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>   u32 val;
> 
> The failure scenario here is the offset passed into a the
> stub regmap_read() function that does not modify its output,
> however regmap_read() can also fail for other reasons, so
> adding error handling (in this case, returning zero from
> is_running) seems the best solution.
> 
> Note that this warning showed up with the ARM s5pv210_defconfig,
> indicating that we most likely want to either enable CONFIG_REGMAP
> in that defconfig as well, or disable the phy-exynos-mipi-video
> driver.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
> ---
>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
> index cc093ebfda94..8b851f718123 100644
> --- a/drivers/phy/phy-exynos-mipi-video.c
> +++ b/drivers/phy/phy-exynos-mipi-video.c
> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>  			struct exynos_mipi_video_phy *state)
>  {
>  	u32 val;

Other way would be to initialize val=0 since there is no real error code
returned. Anyway:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

> +	int ret;
> +
> +	ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
> +	if (ret)
> +		return 0;
>  
> -	regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
>  	return val & data->resetn_val;
>  }
>  
> -- 
> 2.7.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
  2016-05-11 18:51   ` Krzysztof Kozlowski
@ 2016-05-25 18:54     ` Arnd Bergmann
  -1 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-05-25 18:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Kishon Vijay Abraham I, Kukjin Kim, Krzysztof Kozlowski,
	Sylwester Nawrocki, Marek Szyprowski, linux-kernel,
	linux-arm-kernel, linux-samsung-soc

On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
> > A rework of the exynos-mipi-video driver caused a warning
> > about the new __set_phy_state function potentially accessing
> > a variable before its initialization:
> > 
> > drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
> > drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >   return val & data->resetn_val;
> >          ~~~~^~~~~~~~~~~~~~~~~~
> > drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
> >   u32 val;
> > 
> > The failure scenario here is the offset passed into a the
> > stub regmap_read() function that does not modify its output,
> > however regmap_read() can also fail for other reasons, so
> > adding error handling (in this case, returning zero from
> > is_running) seems the best solution.
> > 
> > Note that this warning showed up with the ARM s5pv210_defconfig,
> > indicating that we most likely want to either enable CONFIG_REGMAP
> > in that defconfig as well, or disable the phy-exynos-mipi-video
> > driver.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
> > ---
> >  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
> > index cc093ebfda94..8b851f718123 100644
> > --- a/drivers/phy/phy-exynos-mipi-video.c
> > +++ b/drivers/phy/phy-exynos-mipi-video.c
> > @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
> >                       struct exynos_mipi_video_phy *state)
> >  {
> >       u32 val;
> 
> Other way would be to initialize val=0 since there is no real error code
> returned. Anyway:
> 
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>


This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

	Arnd

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

* [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
@ 2016-05-25 18:54     ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-05-25 18:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
> > A rework of the exynos-mipi-video driver caused a warning
> > about the new __set_phy_state function potentially accessing
> > a variable before its initialization:
> > 
> > drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
> > drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >   return val & data->resetn_val;
> >          ~~~~^~~~~~~~~~~~~~~~~~
> > drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
> >   u32 val;
> > 
> > The failure scenario here is the offset passed into a the
> > stub regmap_read() function that does not modify its output,
> > however regmap_read() can also fail for other reasons, so
> > adding error handling (in this case, returning zero from
> > is_running) seems the best solution.
> > 
> > Note that this warning showed up with the ARM s5pv210_defconfig,
> > indicating that we most likely want to either enable CONFIG_REGMAP
> > in that defconfig as well, or disable the phy-exynos-mipi-video
> > driver.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
> > ---
> >  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
> > index cc093ebfda94..8b851f718123 100644
> > --- a/drivers/phy/phy-exynos-mipi-video.c
> > +++ b/drivers/phy/phy-exynos-mipi-video.c
> > @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
> >                       struct exynos_mipi_video_phy *state)
> >  {
> >       u32 val;
> 
> Other way would be to initialize val=0 since there is no real error code
> returned. Anyway:
> 
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>


This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

	Arnd

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

* Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
  2016-05-25 18:54     ` Arnd Bergmann
  (?)
@ 2016-05-26  5:59       ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2016-05-26  5:59 UTC (permalink / raw)
  To: Arnd Bergmann, Krzysztof Kozlowski
  Cc: Kukjin Kim, Krzysztof Kozlowski, Sylwester Nawrocki,
	Marek Szyprowski, linux-kernel, linux-arm-kernel,
	linux-samsung-soc

Hi Arnd,

On Thursday 26 May 2016 12:24 AM, Arnd Bergmann wrote:
> On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
>> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
>>> A rework of the exynos-mipi-video driver caused a warning
>>> about the new __set_phy_state function potentially accessing
>>> a variable before its initialization:
>>>
>>> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
>>> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>   return val & data->resetn_val;
>>>          ~~~~^~~~~~~~~~~~~~~~~~
>>> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>>>   u32 val;
>>>
>>> The failure scenario here is the offset passed into a the
>>> stub regmap_read() function that does not modify its output,
>>> however regmap_read() can also fail for other reasons, so
>>> adding error handling (in this case, returning zero from
>>> is_running) seems the best solution.
>>>
>>> Note that this warning showed up with the ARM s5pv210_defconfig,
>>> indicating that we most likely want to either enable CONFIG_REGMAP
>>> in that defconfig as well, or disable the phy-exynos-mipi-video
>>> driver.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
>>> ---
>>>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
>>> index cc093ebfda94..8b851f718123 100644
>>> --- a/drivers/phy/phy-exynos-mipi-video.c
>>> +++ b/drivers/phy/phy-exynos-mipi-video.c
>>> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>>>                       struct exynos_mipi_video_phy *state)
>>>  {
>>>       u32 val;
>>
>> Other way would be to initialize val=0 since there is no real error code
>> returned. Anyway:
>>
>> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> 
> This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

Not in -rc1. Mostly it'll go in -rc2. Generally I start queuing patches after
-rc1 is tagged.

Thanks
Kishon

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

* Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
@ 2016-05-26  5:59       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2016-05-26  5:59 UTC (permalink / raw)
  To: Arnd Bergmann, Krzysztof Kozlowski
  Cc: Kukjin Kim, Krzysztof Kozlowski, Sylwester Nawrocki,
	Marek Szyprowski, linux-kernel, linux-arm-kernel,
	linux-samsung-soc

Hi Arnd,

On Thursday 26 May 2016 12:24 AM, Arnd Bergmann wrote:
> On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
>> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
>>> A rework of the exynos-mipi-video driver caused a warning
>>> about the new __set_phy_state function potentially accessing
>>> a variable before its initialization:
>>>
>>> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
>>> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>   return val & data->resetn_val;
>>>          ~~~~^~~~~~~~~~~~~~~~~~
>>> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>>>   u32 val;
>>>
>>> The failure scenario here is the offset passed into a the
>>> stub regmap_read() function that does not modify its output,
>>> however regmap_read() can also fail for other reasons, so
>>> adding error handling (in this case, returning zero from
>>> is_running) seems the best solution.
>>>
>>> Note that this warning showed up with the ARM s5pv210_defconfig,
>>> indicating that we most likely want to either enable CONFIG_REGMAP
>>> in that defconfig as well, or disable the phy-exynos-mipi-video
>>> driver.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
>>> ---
>>>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
>>> index cc093ebfda94..8b851f718123 100644
>>> --- a/drivers/phy/phy-exynos-mipi-video.c
>>> +++ b/drivers/phy/phy-exynos-mipi-video.c
>>> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>>>                       struct exynos_mipi_video_phy *state)
>>>  {
>>>       u32 val;
>>
>> Other way would be to initialize val=0 since there is no real error code
>> returned. Anyway:
>>
>> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> 
> This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

Not in -rc1. Mostly it'll go in -rc2. Generally I start queuing patches after
-rc1 is tagged.

Thanks
Kishon

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

* [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use
@ 2016-05-26  5:59       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2016-05-26  5:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

On Thursday 26 May 2016 12:24 AM, Arnd Bergmann wrote:
> On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote:
>> On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote:
>>> A rework of the exynos-mipi-video driver caused a warning
>>> about the new __set_phy_state function potentially accessing
>>> a variable before its initialization:
>>>
>>> drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state':
>>> drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>>   return val & data->resetn_val;
>>>          ~~~~^~~~~~~~~~~~~~~~~~
>>> drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here
>>>   u32 val;
>>>
>>> The failure scenario here is the offset passed into a the
>>> stub regmap_read() function that does not modify its output,
>>> however regmap_read() can also fail for other reasons, so
>>> adding error handling (in this case, returning zero from
>>> is_running) seems the best solution.
>>>
>>> Note that this warning showed up with the ARM s5pv210_defconfig,
>>> indicating that we most likely want to either enable CONFIG_REGMAP
>>> in that defconfig as well, or disable the phy-exynos-mipi-video
>>> driver.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers")
>>> ---
>>>  drivers/phy/phy-exynos-mipi-video.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
>>> index cc093ebfda94..8b851f718123 100644
>>> --- a/drivers/phy/phy-exynos-mipi-video.c
>>> +++ b/drivers/phy/phy-exynos-mipi-video.c
>>> @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data,
>>>                       struct exynos_mipi_video_phy *state)
>>>  {
>>>       u32 val;
>>
>> Other way would be to initialize val=0 since there is no real error code
>> returned. Anyway:
>>
>> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> 
> This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2?

Not in -rc1. Mostly it'll go in -rc2. Generally I start queuing patches after
-rc1 is tagged.

Thanks
Kishon

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

end of thread, other threads:[~2016-05-26  5:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 12:49 [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use Arnd Bergmann
2016-05-11 12:49 ` Arnd Bergmann
2016-05-11 18:51 ` Krzysztof Kozlowski
2016-05-11 18:51   ` Krzysztof Kozlowski
2016-05-25 18:54   ` Arnd Bergmann
2016-05-25 18:54     ` Arnd Bergmann
2016-05-26  5:59     ` Kishon Vijay Abraham I
2016-05-26  5:59       ` Kishon Vijay Abraham I
2016-05-26  5:59       ` Kishon Vijay Abraham I

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.