Skip to contentSkip to conversation

net: ena: fix gcc-4.8 missing-braces warning

PATCH In review Arnd Bergmann 2 participants 2 messages Apr 28, 2020 – Apr 30, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ena: fix gcc-4.8 missing-braces warning

Older compilers warn about initializers with incorrect curly braces:

drivers/net/ethernet/amazon/ena/ena_netdev.c: In function 'ena_xdp_xmit_buff':
drivers/net/ethernet/amazon/ena/ena_netdev.c:311:2: error: expected ',' or ';' before 'struct'
struct ena_tx_buffer *tx_info;
^~~~~~
drivers/net/ethernet/amazon/ena/ena_netdev.c:321:2: error: 'tx_info' undeclared (first use in this function)
tx_info = &xdp_ring->tx_buffer_info[req_id];
^~~~~~~
drivers/net/ethernet/amazon/ena/ena_netdev.c:321:2: note: each undeclared identifier is reported only once for each function it appears in

Use the GNU empty initializer extension to avoid this.

Fixes 31aa9857f173 ("net: ena: enable negotiating larger Rx ring size")
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -1
index 2cc765df8da3..ad385652ca24 100644
@@ -307,7 +307,7 @@ static int ena_xdp_xmit_buff(struct net_device *dev,
 			     struct ena_rx_buffer *rx_info)
 {
 	struct ena_adapter *adapter = netdev_priv(dev);
-	struct ena_com_tx_ctx ena_tx_ctx = {0};
+	struct ena_com_tx_ctx ena_tx_ctx = { };
 	struct ena_tx_buffer *tx_info;
 	struct ena_ring *xdp_ring;
 	u16 next_to_use, req_id;
Signature · 1 line
2.26.0
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Wednesday, April 29, 2020 12:51 AM
To: Belgazal, Netanel <[email protected]>; Kiyanovski, Arthur <[email protected]>; David S. Miller <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jakub Kicinski <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Jubran, Samih <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Tzalik, Guy <[email protected]>; Bshara, Saeed <[email protected]>; Machulsky, Zorik <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [EXTERNAL] [PATCH] net: ena: fix gcc-4.8 missing-braces warning

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Older compilers warn about initializers with incorrect curly braces:

drivers/net/ethernet/amazon/ena/ena_netdev.c: In function 'ena_xdp_xmit_buff':
drivers/net/ethernet/amazon/ena/ena_netdev.c:311:2: error: expected ',' or ';' before 'struct'
struct ena_tx_buffer *tx_info;
^~~~~~
drivers/net/ethernet/amazon/ena/ena_netdev.c:321:2: error: 'tx_info' undeclared (first use in this function)
tx_info = &xdp_ring->tx_buffer_info[req_id];
^~~~~~~
drivers/net/ethernet/amazon/ena/ena_netdev.c:321:2: note: each undeclared identifier is reported only once for each function it appears in

Quoted 3 lines

Use the GNU empty initializer extension to avoid this.

Fixes 31aa9857f173 ("net: ena: enable negotiating larger Rx ring size")

Please use the correct fixes, it should be XDP TX commit. Otherwise looks good,
Thanks!

Quoted 20 lines
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -2
index 2cc765df8da3..ad385652ca24 100644
@@ -307,7 +307,7 @@ static int ena_xdp_xmit_buff(struct net_device *dev,
                             struct ena_rx_buffer *rx_info)  {
        struct ena_adapter *adapter = netdev_priv(dev);
-       struct ena_com_tx_ctx ena_tx_ctx = {0};
+       struct ena_com_tx_ctx ena_tx_ctx = { };
        struct ena_tx_buffer *tx_info;
        struct ena_ring *xdp_ring;
        u16 next_to_use, req_id;
--

2.26.0