* [net-next] net: i40e: Use the ARRAY_SIZE macro for aq_to_posix
@ 2020-09-09 8:45 ` Wei Xu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Xu @ 2020-09-09 8:45 UTC (permalink / raw)
To: netdev
Cc: davem, xuwei5, linuxarm, shameerali.kolothum.thodi,
jonathan.cameron, john.garry, salil.mehta, shiju.jose, jinying,
zhangyi.ac, liguozhu, tangkunshan, huangdaode, Jeff Kirsher,
Jakub Kicinski, intel-wired-lan, linux-kernel
Use the ARRAY_SIZE macro to calculate the size of an array.
This code was detected with the help of Coccinelle.
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
---
drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
index edec3df..11c5fca 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
@@ -120,7 +120,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
if (aq_ret == I40E_ERR_ADMIN_QUEUE_TIMEOUT)
return -EAGAIN;
- if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0]))))
+ if (!((u32)aq_rc < ARRAY_SIZE(aq_to_posix)))
return -ERANGE;
return aq_to_posix[aq_rc];
--
2.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Intel-wired-lan] [net-next] net: i40e: Use the ARRAY_SIZE macro for aq_to_posix
@ 2020-09-09 8:45 ` Wei Xu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Xu @ 2020-09-09 8:45 UTC (permalink / raw)
To: intel-wired-lan
Use the ARRAY_SIZE macro to calculate the size of an array.
This code was detected with the help of Coccinelle.
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
---
drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
index edec3df..11c5fca 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
@@ -120,7 +120,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
if (aq_ret == I40E_ERR_ADMIN_QUEUE_TIMEOUT)
return -EAGAIN;
- if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0]))))
+ if (!((u32)aq_rc < ARRAY_SIZE(aq_to_posix)))
return -ERANGE;
return aq_to_posix[aq_rc];
--
2.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-09 8:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 8:45 [net-next] net: i40e: Use the ARRAY_SIZE macro for aq_to_posix Wei Xu
2020-09-09 8:45 ` [Intel-wired-lan] " Wei Xu
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.