summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2018-01-17 15:09:56 +0100
committerMichael Brown2018-01-17 15:09:56 +0100
commitfbe8c52d0d9cdb3d6f5fe8be8edab54618becc1f (patch)
tree2436ea8cc1925755f79b3df7bd26a6da08e10b5c
parent[netdevice] Make netdev_irq_enabled() independent of netdev_irq_supported() (diff)
downloadipxe-fbe8c52d0d9cdb3d6f5fe8be8edab54618becc1f.tar.gz
ipxe-fbe8c52d0d9cdb3d6f5fe8be8edab54618becc1f.tar.xz
ipxe-fbe8c52d0d9cdb3d6f5fe8be8edab54618becc1f.zip
[ena] Fix spurious uninitialised variable warning on older versions of gcc
Some older versions of gcc (observed with gcc 4.7.2) report a spurious uninitialised variable warning in ena_get_device_attributes(). Work around this warning by manually inlining the relevant code (which has only a single call site). Reported-by: xbgmsharp <xbgmsharp@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/net/ena.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/drivers/net/ena.c b/src/drivers/net/ena.c
index b6d8bc6f..8d29979b 100644
--- a/src/drivers/net/ena.c
+++ b/src/drivers/net/ena.c
@@ -540,54 +540,30 @@ static int ena_destroy_qp ( struct ena_nic *ena, struct ena_qp *qp ) {
}
/**
- * Get feature
+ * Get device attributes
*
- * @v ena ENA device
- * @v id Feature identifier
- * @v feature Feature to fill in
+ * @v netdev Network device
* @ret rc Return status code
*/
-static int ena_get_feature ( struct ena_nic *ena, unsigned int id,
- union ena_feature **feature ) {
+static int ena_get_device_attributes ( struct net_device *netdev ) {
+ struct ena_nic *ena = netdev->priv;
union ena_aq_req *req;
union ena_acq_rsp *rsp;
+ union ena_feature *feature;
int rc;
/* Construct request */
req = ena_admin_req ( ena );
req->header.opcode = ENA_GET_FEATURE;
- req->get_feature.id = id;
+ req->get_feature.id = ENA_DEVICE_ATTRIBUTES;
/* Issue request */
if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
return rc;
/* Parse response */
- *feature = &rsp->get_feature.feature;
-
- return 0;
-}
-
-/**
- * Get device attributes
- *
- * @v netdev Network device
- * @ret rc Return status code
- */
-static int ena_get_device_attributes ( struct net_device *netdev ) {
- struct ena_nic *ena = netdev->priv;
- union ena_feature *feature;
- int rc;
-
- /* Get device attributes */
- if ( ( rc = ena_get_feature ( ena, ENA_DEVICE_ATTRIBUTES,
- &feature ) ) != 0 )
- return rc;
-
- /* Extract MAC address */
+ feature = &rsp->get_feature.feature;
memcpy ( netdev->hw_addr, feature->device.mac, ETH_ALEN );
-
- /* Extract MTU */
netdev->max_pkt_len = le32_to_cpu ( feature->device.mtu );
DBGC ( ena, "ENA %p MAC %s MTU %zd\n",