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>

authored by Edward Cree and committed by David S. Miller d0346b03 48051c37

+5 -5
+5 -5
drivers/net/ethernet/sfc/ef10.c
··· 828 static int efx_ef10_link_piobufs(struct efx_nic *efx) 829 { 830 struct efx_ef10_nic_data *nic_data = efx->nic_data; 831 - _MCDI_DECLARE_BUF(inbuf, 832 - max(MC_CMD_LINK_PIOBUF_IN_LEN, 833 - MC_CMD_UNLINK_PIOBUF_IN_LEN)); 834 struct efx_channel *channel; 835 struct efx_tx_queue *tx_queue; 836 unsigned int offset, index; ··· 836 837 BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_OUT_LEN != 0); 838 BUILD_BUG_ON(MC_CMD_UNLINK_PIOBUF_OUT_LEN != 0); 839 - 840 - memset(inbuf, 0, sizeof(inbuf)); 841 842 /* Link a buffer to each VI in the write-combining mapping */ 843 for (index = 0; index < nic_data->n_piobufs; ++index) { ··· 916 return 0; 917 918 fail: 919 while (index--) { 920 MCDI_SET_DWORD(inbuf, UNLINK_PIOBUF_IN_TXQ_INSTANCE, 921 nic_data->pio_write_vi_base + index);
··· 828 static int efx_ef10_link_piobufs(struct efx_nic *efx) 829 { 830 struct efx_ef10_nic_data *nic_data = efx->nic_data; 831 + MCDI_DECLARE_BUF(inbuf, MC_CMD_LINK_PIOBUF_IN_LEN); 832 struct efx_channel *channel; 833 struct efx_tx_queue *tx_queue; 834 unsigned int offset, index; ··· 838 839 BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_OUT_LEN != 0); 840 BUILD_BUG_ON(MC_CMD_UNLINK_PIOBUF_OUT_LEN != 0); 841 842 /* Link a buffer to each VI in the write-combining mapping */ 843 for (index = 0; index < nic_data->n_piobufs; ++index) { ··· 920 return 0; 921 922 fail: 923 + /* inbuf was defined for MC_CMD_LINK_PIOBUF. We can use the same 924 + * buffer for MC_CMD_UNLINK_PIOBUF because it's shorter. 925 + */ 926 + BUILD_BUG_ON(MC_CMD_LINK_PIOBUF_IN_LEN < MC_CMD_UNLINK_PIOBUF_IN_LEN); 927 while (index--) { 928 MCDI_SET_DWORD(inbuf, UNLINK_PIOBUF_IN_TXQ_INSTANCE, 929 nic_data->pio_write_vi_base + index);