aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2017-03-03 10:22:09 -0500
committerDavid S. Miller <davem@davemloft.net>2017-03-03 13:06:38 -0500
commitd0346b033899b9affa4da8c32bfb574dfb89859e (patch)
tree9afa9a52d221bdedb2523a3d343972b86b5a9c05
parent48051c375cac3e0f8f52ccda30329e35da980066 (diff)
sfc: avoid max() in array size
It confuses sparse, which thinks the size isn't constant. Let's achieve the same thing with a BUILD_BUG_ON, since we know which one should be bigger and don't expect them ever to change. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/sfc/ef10.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 92e1c6d8b293..4d88e8532d3e 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -828,9 +828,7 @@ static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n)
828static int efx_ef10_link_piobufs(struct efx_nic *efx) 828static int efx_ef10_link_piobufs(struct efx_nic *efx)
829{ 829{
830 struct efx_ef10_nic_data *nic_data = efx->nic_data; 830 struct efx_ef10_nic_data *nic_data = efx->nic_data;
831 _MCDI_DECLARE_BUF(inbuf, 831 MCDI_DECLARE_BUF(inbuf, MC_CMD_LINK_PIOBUF_IN_LEN);
832 max(MC_CMD_LINK_PIOBUF_IN_LEN,
833 MC_CMD_UNLINK_PIOBUF_IN_LEN));
834 struct efx_channel *channel; 832 struct efx_channel *channel;
835 struct efx_tx_queue *tx_queue; 833 struct efx_tx_queue *tx_queue;
836 unsigned int offset, index; 834 unsigned int offset, index;
@@ -839,8 +837,6 @@ static int efx_ef10_link_piobufs(struct efx_nic *efx)
839 BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_OUT_LEN != 0); 837 BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_OUT_LEN != 0);
840 BUILD_BUG_ON(MC_CMD_UNLINK_PIOBUF_OUT_LEN != 0); 838 BUILD_BUG_ON(MC_CMD_UNLINK_PIOBUF_OUT_LEN != 0);
841 839
842 memset(inbuf, 0, sizeof(inbuf));
843
844 /* Link a buffer to each VI in the write-combining mapping */ 840 /* Link a buffer to each VI in the write-combining mapping */
845 for (index = 0; index < nic_data->n_piobufs; ++index) { 841 for (index = 0; index < nic_data->n_piobufs; ++index) {
846 MCDI_SET_DWORD(inbuf, LINK_PIOBUF_IN_PIOBUF_HANDLE, 842 MCDI_SET_DWORD(inbuf, LINK_PIOBUF_IN_PIOBUF_HANDLE,
@@ -920,6 +916,10 @@ static int efx_ef10_link_piobufs(struct efx_nic *efx)
920 return 0; 916 return 0;
921 917
922fail: 918fail:
919 /* inbuf was defined for MC_CMD_LINK_PIOBUF. We can use the same
920 * buffer for MC_CMD_UNLINK_PIOBUF because it's shorter.
921 */
922 BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_IN_LEN < MC_CMD_UNLINK_PIOBUF_IN_LEN);
923 while (index--) { 923 while (index--) {
924 MCDI_SET_DWORD(inbuf, UNLINK_PIOBUF_IN_TXQ_INSTANCE, 924 MCDI_SET_DWORD(inbuf, UNLINK_PIOBUF_IN_TXQ_INSTANCE,
925 nic_data->pio_write_vi_base + index); 925 nic_data->pio_write_vi_base + index);