linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait
@ 2018-11-19 12:48 YueHaibing
  2018-11-21  0:03 ` Jeff Kirsher
  2018-12-01  3:01 ` [Intel-wired-lan] " Brown, Aaron F
  0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2018-11-19 12:48 UTC (permalink / raw)
  To: davem, jeffrey.t.kirsher
  Cc: linux-kernel, netdev, intel-wired-lan, YueHaibing

Fix a static code checker warning:
drivers/net/ethernet/intel/e100.c:1349
 e100_load_ucode_wait() warn: passing zero to 'PTR_ERR'

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/intel/e100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 7c4b554..736115b 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -1345,8 +1345,8 @@ static inline int e100_load_ucode_wait(struct nic *nic)
 
 	fw = e100_request_firmware(nic);
 	/* If it's NULL, then no ucode is required */
-	if (!fw || IS_ERR(fw))
-		return PTR_ERR(fw);
+	if (IS_ERR_OR_NULL(fw))
+		return PTR_ERR_OR_ZERO(fw);
 
 	if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode)))
 		netif_err(nic, probe, nic->netdev,
-- 
2.7.0



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

* Re: [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait
  2018-11-19 12:48 [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait YueHaibing
@ 2018-11-21  0:03 ` Jeff Kirsher
  2018-12-01  3:01 ` [Intel-wired-lan] " Brown, Aaron F
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Kirsher @ 2018-11-21  0:03 UTC (permalink / raw)
  To: YueHaibing, davem; +Cc: linux-kernel, netdev, intel-wired-lan

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

On Mon, 2018-11-19 at 20:48 +0800, YueHaibing wrote:
> Fix a static code checker warning:
> drivers/net/ethernet/intel/e100.c:1349
>  e100_load_ucode_wait() warn: passing zero to 'PTR_ERR'
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/net/ethernet/intel/e100.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

This looks fine, I am just concerned of the regression testing needed on
hardware that is almost 20 years old now.  The availability of the hardware
for testing is also a concern.

> diff --git a/drivers/net/ethernet/intel/e100.c
> b/drivers/net/ethernet/intel/e100.c
> index 7c4b554..736115b 100644
> --- a/drivers/net/ethernet/intel/e100.c
> +++ b/drivers/net/ethernet/intel/e100.c
> @@ -1345,8 +1345,8 @@ static inline int e100_load_ucode_wait(struct nic
> *nic)
>  
>  	fw = e100_request_firmware(nic);
>  	/* If it's NULL, then no ucode is required */
> -	if (!fw || IS_ERR(fw))
> -		return PTR_ERR(fw);
> +	if (IS_ERR_OR_NULL(fw))
> +		return PTR_ERR_OR_ZERO(fw);
>  
>  	if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode)))
>  		netif_err(nic, probe, nic->netdev,


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [Intel-wired-lan] [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait
  2018-11-19 12:48 [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait YueHaibing
  2018-11-21  0:03 ` Jeff Kirsher
@ 2018-12-01  3:01 ` Brown, Aaron F
  1 sibling, 0 replies; 3+ messages in thread
From: Brown, Aaron F @ 2018-12-01  3:01 UTC (permalink / raw)
  To: YueHaibing, davem, Kirsher, Jeffrey T
  Cc: netdev, intel-wired-lan, linux-kernel

> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of YueHaibing
> Sent: Monday, November 19, 2018 4:48 AM
> To: davem@davemloft.net; Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>
> Cc: netdev@vger.kernel.org; YueHaibing <yuehaibing@huawei.com>; intel-
> wired-lan@lists.osuosl.org; linux-kernel@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH net-next] e100: Fix passing zero to
> 'PTR_ERR' warning in e100_load_ucode_wait
> 
> Fix a static code checker warning:
> drivers/net/ethernet/intel/e100.c:1349
>  e100_load_ucode_wait() warn: passing zero to 'PTR_ERR'
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/net/ethernet/intel/e100.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Tested-by: Aaron Brown <aaron.f.brown@intel.com>

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

end of thread, other threads:[~2018-12-01  3:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 12:48 [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait YueHaibing
2018-11-21  0:03 ` Jeff Kirsher
2018-12-01  3:01 ` [Intel-wired-lan] " Brown, Aaron F

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).