All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] igc: change default return of igc_read_phy_reg()
@ 2021-05-21 19:50 ` trix
  0 siblings, 0 replies; 6+ messages in thread
From: trix @ 2021-05-21 19:50 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, davem, kuba,
	jeffrey.t.kirsher, sasha.neftin
  Cc: intel-wired-lan, netdev, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem

igc_main.c:4944:20: warning: The left operand of '&'
  is a garbage value
    if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
          ~~~~~~~~ ^

pyy_data is set by the call to igc_read_phy_reg() only if
there is a read_reg() op, else it is unset and a 0 is
returned.  Change the return to -EOPNOTSUPP.

Fixes: 208983f099d9 ("igc: Add watchdog")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/intel/igc/igc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index b6d3277c6f520..71100ee7afbee 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -577,7 +577,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
 	if (hw->phy.ops.read_reg)
 		return hw->phy.ops.read_reg(hw, offset, data);
 
-	return 0;
+	return -EOPNOTSUPP;
 }
 
 void igc_reinit_locked(struct igc_adapter *);
-- 
2.26.3


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

* [Intel-wired-lan] [PATCH] igc: change default return of igc_read_phy_reg()
@ 2021-05-21 19:50 ` trix
  0 siblings, 0 replies; 6+ messages in thread
From: trix @ 2021-05-21 19:50 UTC (permalink / raw)
  To: intel-wired-lan

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem

igc_main.c:4944:20: warning: The left operand of '&'
  is a garbage value
    if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
          ~~~~~~~~ ^

pyy_data is set by the call to igc_read_phy_reg() only if
there is a read_reg() op, else it is unset and a 0 is
returned.  Change the return to -EOPNOTSUPP.

Fixes: 208983f099d9 ("igc: Add watchdog")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/intel/igc/igc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index b6d3277c6f520..71100ee7afbee 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -577,7 +577,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
 	if (hw->phy.ops.read_reg)
 		return hw->phy.ops.read_reg(hw, offset, data);
 
-	return 0;
+	return -EOPNOTSUPP;
 }
 
 void igc_reinit_locked(struct igc_adapter *);
-- 
2.26.3


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

* Re: [PATCH] igc: change default return of igc_read_phy_reg()
  2021-05-21 19:50 ` [Intel-wired-lan] " trix
@ 2021-05-23  5:47   ` Neftin, Sasha
  -1 siblings, 0 replies; 6+ messages in thread
From: Neftin, Sasha @ 2021-05-23  5:47 UTC (permalink / raw)
  To: trix, jesse.brandeburg, anthony.l.nguyen, davem, kuba
  Cc: intel-wired-lan, netdev, linux-kernel, Neftin, Sasha, Fuxbrumer, DvoraX

On 5/21/2021 22:50, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Static analysis reports this problem
> 
> igc_main.c:4944:20: warning: The left operand of '&'
>    is a garbage value
>      if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
>            ~~~~~~~~ ^
Tom, thanks for this patch. I believe the same static analysis problem 
should be with the 'igb_read_phy_reg' method:
https://elixir.bootlin.com/linux/v5.13-rc1/source/drivers/net/ethernet/intel/igb/igb.h#L769
> 
> pyy_data is set by the call to igc_read_phy_reg() only if
%s/pyy_data/phy_data/gc (typo)
> there is a read_reg() op, else it is unset and a 0 is
> returned.  Change the return to -EOPNOTSUPP.
> 
> Fixes: 208983f099d9 ("igc: Add watchdog")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/net/ethernet/intel/igc/igc.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
> index b6d3277c6f520..71100ee7afbee 100644
> --- a/drivers/net/ethernet/intel/igc/igc.h
> +++ b/drivers/net/ethernet/intel/igc/igc.h
> @@ -577,7 +577,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
>   	if (hw->phy.ops.read_reg)
>   		return hw->phy.ops.read_reg(hw, offset, data);
>   
> -	return 0;
> +	return -EOPNOTSUPP;
>   }
>   
>   void igc_reinit_locked(struct igc_adapter *);
> 
Thanks,
Sasha

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

* [Intel-wired-lan] [PATCH] igc: change default return of igc_read_phy_reg()
@ 2021-05-23  5:47   ` Neftin, Sasha
  0 siblings, 0 replies; 6+ messages in thread
From: Neftin, Sasha @ 2021-05-23  5:47 UTC (permalink / raw)
  To: intel-wired-lan

On 5/21/2021 22:50, trix at redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Static analysis reports this problem
> 
> igc_main.c:4944:20: warning: The left operand of '&'
>    is a garbage value
>      if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
>            ~~~~~~~~ ^
Tom, thanks for this patch. I believe the same static analysis problem 
should be with the 'igb_read_phy_reg' method:
https://elixir.bootlin.com/linux/v5.13-rc1/source/drivers/net/ethernet/intel/igb/igb.h#L769
> 
> pyy_data is set by the call to igc_read_phy_reg() only if
%s/pyy_data/phy_data/gc (typo)
> there is a read_reg() op, else it is unset and a 0 is
> returned.  Change the return to -EOPNOTSUPP.
> 
> Fixes: 208983f099d9 ("igc: Add watchdog")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/net/ethernet/intel/igc/igc.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
> index b6d3277c6f520..71100ee7afbee 100644
> --- a/drivers/net/ethernet/intel/igc/igc.h
> +++ b/drivers/net/ethernet/intel/igc/igc.h
> @@ -577,7 +577,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
>   	if (hw->phy.ops.read_reg)
>   		return hw->phy.ops.read_reg(hw, offset, data);
>   
> -	return 0;
> +	return -EOPNOTSUPP;
>   }
>   
>   void igc_reinit_locked(struct igc_adapter *);
> 
Thanks,
Sasha

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

* Re: [Intel-wired-lan] [PATCH] igc: change default return of igc_read_phy_reg()
  2021-05-21 19:50 ` [Intel-wired-lan] " trix
@ 2021-06-24 19:58   ` Fuxbrumer, Dvora
  -1 siblings, 0 replies; 6+ messages in thread
From: Fuxbrumer, Dvora @ 2021-06-24 19:58 UTC (permalink / raw)
  To: trix, jesse.brandeburg, anthony.l.nguyen, davem, kuba,
	jeffrey.t.kirsher, sasha.neftin
  Cc: netdev, intel-wired-lan, linux-kernel

On 5/21/2021 22:50, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Static analysis reports this problem
> 
> igc_main.c:4944:20: warning: The left operand of '&'
>    is a garbage value
>      if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
>            ~~~~~~~~ ^
> 
> pyy_data is set by the call to igc_read_phy_reg() only if
> there is a read_reg() op, else it is unset and a 0 is
> returned.  Change the return to -EOPNOTSUPP.
> 
> Fixes: 208983f099d9 ("igc: Add watchdog")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/net/ethernet/intel/igc/igc.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>

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

* [Intel-wired-lan] [PATCH] igc: change default return of igc_read_phy_reg()
@ 2021-06-24 19:58   ` Fuxbrumer, Dvora
  0 siblings, 0 replies; 6+ messages in thread
From: Fuxbrumer, Dvora @ 2021-06-24 19:58 UTC (permalink / raw)
  To: intel-wired-lan

On 5/21/2021 22:50, trix at redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Static analysis reports this problem
> 
> igc_main.c:4944:20: warning: The left operand of '&'
>    is a garbage value
>      if (!(phy_data & SR_1000T_REMOTE_RX_STATUS) &&
>            ~~~~~~~~ ^
> 
> pyy_data is set by the call to igc_read_phy_reg() only if
> there is a read_reg() op, else it is unset and a 0 is
> returned.  Change the return to -EOPNOTSUPP.
> 
> Fixes: 208983f099d9 ("igc: Add watchdog")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/net/ethernet/intel/igc/igc.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>

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

end of thread, other threads:[~2021-06-24 19:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 19:50 [PATCH] igc: change default return of igc_read_phy_reg() trix
2021-05-21 19:50 ` [Intel-wired-lan] " trix
2021-05-23  5:47 ` Neftin, Sasha
2021-05-23  5:47   ` [Intel-wired-lan] " Neftin, Sasha
2021-06-24 19:58 ` Fuxbrumer, Dvora
2021-06-24 19:58   ` Fuxbrumer, Dvora

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.