All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
@ 2014-08-25 15:50 ` Chen-Yu Tsai
  0 siblings, 0 replies; 8+ messages in thread
From: Chen-Yu Tsai @ 2014-08-25 15:50 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Chen-Yu Tsai, Maxime Ripard, Gregory CLEMENT, linux-i2c,
	linux-kernel, linux-arm-kernel, stable

The "clock-frequency" DT property is listed as optional, However,
the current code stores the return value of of_property_read_u32 in
the return code of mv64xxx_of_config, but then forgets to clear it
after setting the default value of "clock-frequency". It is then
passed out to the main probe function, resulting in a probe failure
when "clock-frequency" is missing.

This patch checks and then throws away the result of
of_property_read_u32, instead of storing it and having to clear it
afterwards.

This issue was discovered after the property was removed from all
sunxi DTs.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Cc: stable@vger.kernel.org
---
 drivers/i2c/busses/i2c-mv64xxx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 6dc5ded..2f64273 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
 	}
 	tclk = clk_get_rate(drv_data->clk);
 
-	rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
-	if (rc)
+	if (of_property_read_u32(np, "clock-frequency", &bus_freq))
 		bus_freq = 100000; /* 100kHz by default */
 
 	if (!mv64xxx_find_baud_factors(bus_freq, tclk,
-- 
2.1.0

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

* [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
@ 2014-08-25 15:50 ` Chen-Yu Tsai
  0 siblings, 0 replies; 8+ messages in thread
From: Chen-Yu Tsai @ 2014-08-25 15:50 UTC (permalink / raw)
  To: linux-arm-kernel

The "clock-frequency" DT property is listed as optional, However,
the current code stores the return value of of_property_read_u32 in
the return code of mv64xxx_of_config, but then forgets to clear it
after setting the default value of "clock-frequency". It is then
passed out to the main probe function, resulting in a probe failure
when "clock-frequency" is missing.

This patch checks and then throws away the result of
of_property_read_u32, instead of storing it and having to clear it
afterwards.

This issue was discovered after the property was removed from all
sunxi DTs.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Cc: stable at vger.kernel.org
---
 drivers/i2c/busses/i2c-mv64xxx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 6dc5ded..2f64273 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
 	}
 	tclk = clk_get_rate(drv_data->clk);
 
-	rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
-	if (rc)
+	if (of_property_read_u32(np, "clock-frequency", &bus_freq))
 		bus_freq = 100000; /* 100kHz by default */
 
 	if (!mv64xxx_find_baud_factors(bus_freq, tclk,
-- 
2.1.0

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

* Re: [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
  2014-08-25 15:50 ` Chen-Yu Tsai
@ 2014-08-25 16:10   ` Maxime Ripard
  -1 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2014-08-25 16:10 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Wolfram Sang, Gregory CLEMENT, linux-i2c, linux-kernel,
	linux-arm-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

On Mon, Aug 25, 2014 at 11:50:19PM +0800, Chen-Yu Tsai wrote:
> The "clock-frequency" DT property is listed as optional, However,
> the current code stores the return value of of_property_read_u32 in
> the return code of mv64xxx_of_config, but then forgets to clear it
> after setting the default value of "clock-frequency". It is then
> passed out to the main probe function, resulting in a probe failure
> when "clock-frequency" is missing.
> 
> This patch checks and then throws away the result of
> of_property_read_u32, instead of storing it and having to clear it
> afterwards.
> 
> This issue was discovered after the property was removed from all
> sunxi DTs.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Cc: stable@vger.kernel.org

Good catch!

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
@ 2014-08-25 16:10   ` Maxime Ripard
  0 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2014-08-25 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 25, 2014 at 11:50:19PM +0800, Chen-Yu Tsai wrote:
> The "clock-frequency" DT property is listed as optional, However,
> the current code stores the return value of of_property_read_u32 in
> the return code of mv64xxx_of_config, but then forgets to clear it
> after setting the default value of "clock-frequency". It is then
> passed out to the main probe function, resulting in a probe failure
> when "clock-frequency" is missing.
> 
> This patch checks and then throws away the result of
> of_property_read_u32, instead of storing it and having to clear it
> afterwards.
> 
> This issue was discovered after the property was removed from all
> sunxi DTs.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Cc: stable at vger.kernel.org

Good catch!

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140825/73a862e2/attachment.sig>

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

* Re: [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
  2014-08-25 15:50 ` Chen-Yu Tsai
@ 2014-08-25 16:41   ` Andrew Lunn
  -1 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2014-08-25 16:41 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Wolfram Sang, linux-kernel, stable, linux-i2c, Gregory CLEMENT,
	Maxime Ripard, linux-arm-kernel

On Mon, Aug 25, 2014 at 11:50:19PM +0800, Chen-Yu Tsai wrote:
> The "clock-frequency" DT property is listed as optional, However,
> the current code stores the return value of of_property_read_u32 in
> the return code of mv64xxx_of_config, but then forgets to clear it
> after setting the default value of "clock-frequency". It is then
> passed out to the main probe function, resulting in a probe failure
> when "clock-frequency" is missing.
> 
> This patch checks and then throws away the result of
> of_property_read_u32, instead of storing it and having to clear it
> afterwards.
> 
> This issue was discovered after the property was removed from all
> sunxi DTs.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Cc: stable@vger.kernel.org

It would be good to add

Fixes: 4c730a06c19bb ("i2c: mv64xxx: Set bus frequency to 100kHz if clock-frequency is not provided")

Acked-by: Andrew Lunn <andrew@lunn.ch>

	  Andrew


> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index 6dc5ded..2f64273 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
>  	}
>  	tclk = clk_get_rate(drv_data->clk);
>  
> -	rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
> -	if (rc)
> +	if (of_property_read_u32(np, "clock-frequency", &bus_freq))
>  		bus_freq = 100000; /* 100kHz by default */
>  
>  	if (!mv64xxx_find_baud_factors(bus_freq, tclk,
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
@ 2014-08-25 16:41   ` Andrew Lunn
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2014-08-25 16:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 25, 2014 at 11:50:19PM +0800, Chen-Yu Tsai wrote:
> The "clock-frequency" DT property is listed as optional, However,
> the current code stores the return value of of_property_read_u32 in
> the return code of mv64xxx_of_config, but then forgets to clear it
> after setting the default value of "clock-frequency". It is then
> passed out to the main probe function, resulting in a probe failure
> when "clock-frequency" is missing.
> 
> This patch checks and then throws away the result of
> of_property_read_u32, instead of storing it and having to clear it
> afterwards.
> 
> This issue was discovered after the property was removed from all
> sunxi DTs.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Cc: stable at vger.kernel.org

It would be good to add

Fixes: 4c730a06c19bb ("i2c: mv64xxx: Set bus frequency to 100kHz if clock-frequency is not provided")

Acked-by: Andrew Lunn <andrew@lunn.ch>

	  Andrew


> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index 6dc5ded..2f64273 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
>  	}
>  	tclk = clk_get_rate(drv_data->clk);
>  
> -	rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
> -	if (rc)
> +	if (of_property_read_u32(np, "clock-frequency", &bus_freq))
>  		bus_freq = 100000; /* 100kHz by default */
>  
>  	if (!mv64xxx_find_baud_factors(bus_freq, tclk,
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
@ 2015-04-16 19:00 Antony Pavlov
  2015-04-17  5:29 ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Antony Pavlov @ 2015-04-16 19:00 UTC (permalink / raw)
  To: barebox

Based on this linux kernel commit:

    commit 0ce4bc1dbdd911ae1763e2d4ff36bd1b214a59f7
    Author: Chen-Yu Tsai <wens@csie.org>
    Date:   Mon Sep 1 22:28:13 2014 +0800

        i2c: mv64xxx: continue probe when clock-frequency is missing

        The "clock-frequency" DT property is listed as optional, However,
        the current code stores the return value of of_property_read_u32 in
        the return code of mv64xxx_of_config, but then forgets to clear it
        after setting the default value of "clock-frequency". It is then
        passed out to the main probe function, resulting in a probe failure
        when "clock-frequency" is missing.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 6d8c85b..4fd3a6f 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -540,8 +540,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
 	}
 	tclk = clk_get_rate(drv_data->clk);
 
-	rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
-	if (rc)
+	if (of_property_read_u32(np, "clock-frequency", &bus_freq))
 		bus_freq = 100000; /* 100kHz by default */
 
 	if (!mv64xxx_find_baud_factors(bus_freq, tclk,
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing
  2015-04-16 19:00 Antony Pavlov
@ 2015-04-17  5:29 ` Sascha Hauer
  0 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2015-04-17  5:29 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Thu, Apr 16, 2015 at 10:00:45PM +0300, Antony Pavlov wrote:
> Based on this linux kernel commit:
> 
>     commit 0ce4bc1dbdd911ae1763e2d4ff36bd1b214a59f7
>     Author: Chen-Yu Tsai <wens@csie.org>
>     Date:   Mon Sep 1 22:28:13 2014 +0800
> 
>         i2c: mv64xxx: continue probe when clock-frequency is missing
> 
>         The "clock-frequency" DT property is listed as optional, However,
>         the current code stores the return value of of_property_read_u32 in
>         the return code of mv64xxx_of_config, but then forgets to clear it
>         after setting the default value of "clock-frequency". It is then
>         passed out to the main probe function, resulting in a probe failure
>         when "clock-frequency" is missing.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-04-17  5:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 15:50 [PATCH] i2c: mv64xxx: continue probe when clock-frequency is missing Chen-Yu Tsai
2014-08-25 15:50 ` Chen-Yu Tsai
2014-08-25 16:10 ` Maxime Ripard
2014-08-25 16:10   ` Maxime Ripard
2014-08-25 16:41 ` Andrew Lunn
2014-08-25 16:41   ` Andrew Lunn
  -- strict thread matches above, loose matches on Subject: below --
2015-04-16 19:00 Antony Pavlov
2015-04-17  5:29 ` Sascha Hauer

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.