diff mbox

[U-Boot,V2,2/4] compulab: eeprom: propagate error value in read_mac_addr()

Message ID 1441529318-23973-3-git-send-email-nikita@compulab.co.il
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Nikita Kiryanov Sept. 6, 2015, 8:48 a.m. UTC
cl_eeprom_read_mac_addr() doesn't differentiate between success case and
inability to access eeprom. Fix this by propagating the return value of
cl_eeprom_setup().

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V2:
	- New patch

 board/compulab/common/eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Igor Grinberg Sept. 6, 2015, 12:58 p.m. UTC | #1
On 09/06/15 11:48, Nikita Kiryanov wrote:
> cl_eeprom_read_mac_addr() doesn't differentiate between success case and
> inability to access eeprom. Fix this by propagating the return value of
> cl_eeprom_setup().
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

> ---
> Changes in V2:
> 	- New patch
> 
>  board/compulab/common/eeprom.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
> index aaacd2e..9f18a3d 100644
> --- a/board/compulab/common/eeprom.c
> +++ b/board/compulab/common/eeprom.c
> @@ -105,9 +105,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
>  int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
>  {
>  	uint offset;
> +	int err;
>  
> -	if (cl_eeprom_setup(eeprom_bus))
> -		return 0;
> +	err = cl_eeprom_setup(eeprom_bus);
> +	if (err)
> +		return err;
>  
>  	offset = (cl_eeprom_layout != LAYOUT_LEGACY) ?
>  			MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
>
diff mbox

Patch

diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index aaacd2e..9f18a3d 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -105,9 +105,11 @@  void get_board_serial(struct tag_serialnr *serialnr)
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
 {
 	uint offset;
+	int err;
 
-	if (cl_eeprom_setup(eeprom_bus))
-		return 0;
+	err = cl_eeprom_setup(eeprom_bus);
+	if (err)
+		return err;
 
 	offset = (cl_eeprom_layout != LAYOUT_LEGACY) ?
 			MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;