2018-11-19 12:50:08

by Yue Haibing

[permalink] [raw]
Subject: [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 <[email protected]>
---
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




2018-11-21 00:04:14

by Jeff Kirsher

[permalink] [raw]
Subject: Re: [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait

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 <[email protected]>
> ---
> 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,


Attachments:
signature.asc (849.00 B)
This is a digitally signed message part

2018-12-01 03:02:25

by Brown, Aaron F

[permalink] [raw]
Subject: RE: [Intel-wired-lan] [PATCH net-next] e100: Fix passing zero to 'PTR_ERR' warning in e100_load_ucode_wait

> From: Intel-wired-lan [mailto:[email protected]] On
> Behalf Of YueHaibing
> Sent: Monday, November 19, 2018 4:48 AM
> To: [email protected]; Kirsher, Jeffrey T <[email protected]>
> Cc: [email protected]; YueHaibing <[email protected]>; intel-
> [email protected]; [email protected]
> 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 <[email protected]>
> ---
> drivers/net/ethernet/intel/e100.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Tested-by: Aaron Brown <[email protected]>