Browse Source

[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>
tags/v1.20.1
Michael Brown 6 years ago
parent
commit
fbe8c52d0d
1 changed files with 7 additions and 31 deletions
  1. 7
    31
      src/drivers/net/ena.c

+ 7
- 31
src/drivers/net/ena.c View File

@@ -540,54 +540,30 @@ static int ena_destroy_qp ( struct ena_nic *ena, struct ena_qp *qp ) {
540 540
 }
541 541
 
542 542
 /**
543
- * Get feature
543
+ * Get device attributes
544 544
  *
545
- * @v ena		ENA device
546
- * @v id		Feature identifier
547
- * @v feature		Feature to fill in
545
+ * @v netdev		Network device
548 546
  * @ret rc		Return status code
549 547
  */
550
-static int ena_get_feature ( struct ena_nic *ena, unsigned int id,
551
-			     union ena_feature **feature ) {
548
+static int ena_get_device_attributes ( struct net_device *netdev ) {
549
+	struct ena_nic *ena = netdev->priv;
552 550
 	union ena_aq_req *req;
553 551
 	union ena_acq_rsp *rsp;
552
+	union ena_feature *feature;
554 553
 	int rc;
555 554
 
556 555
 	/* Construct request */
557 556
 	req = ena_admin_req ( ena );
558 557
 	req->header.opcode = ENA_GET_FEATURE;
559
-	req->get_feature.id = id;
558
+	req->get_feature.id = ENA_DEVICE_ATTRIBUTES;
560 559
 
561 560
 	/* Issue request */
562 561
 	if ( ( rc = ena_admin ( ena, req, &rsp ) ) != 0 )
563 562
 		return rc;
564 563
 
565 564
 	/* Parse response */
566
-	*feature = &rsp->get_feature.feature;
567
-
568
-	return 0;
569
-}
570
-
571
-/**
572
- * Get device attributes
573
- *
574
- * @v netdev		Network device
575
- * @ret rc		Return status code
576
- */
577
-static int ena_get_device_attributes ( struct net_device *netdev ) {
578
-	struct ena_nic *ena = netdev->priv;
579
-	union ena_feature *feature;
580
-	int rc;
581
-
582
-	/* Get device attributes */
583
-	if ( ( rc = ena_get_feature ( ena, ENA_DEVICE_ATTRIBUTES,
584
-				      &feature ) ) != 0 )
585
-		return rc;
586
-
587
-	/* Extract MAC address */
565
+	feature = &rsp->get_feature.feature;
588 566
 	memcpy ( netdev->hw_addr, feature->device.mac, ETH_ALEN );
589
-
590
-	/* Extract MTU */
591 567
 	netdev->max_pkt_len = le32_to_cpu ( feature->device.mtu );
592 568
 
593 569
 	DBGC ( ena, "ENA %p MAC %s MTU %zd\n",

Loading…
Cancel
Save