Browse Source

Ensure that pxe_netdev is set before starting up PXE NBP.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
071356d976
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      src/arch/i386/image/pxe_image.c

+ 10
- 3
src/arch/i386/image/pxe_image.c View File

38
  * @v image		PXE image
38
  * @v image		PXE image
39
  * @ret rc		Return status code
39
  * @ret rc		Return status code
40
  */
40
  */
41
-static int pxe_exec ( struct image *image __unused ) {
41
+static int pxe_exec ( struct image *image ) {
42
 	struct net_device *netdev;
42
 	struct net_device *netdev;
43
 	int rc;
43
 	int rc;
44
 
44
 
52
 		break;
52
 		break;
53
 	}
53
 	}
54
 
54
 
55
+	/* Many things will break if pxe_netdev is NULL */
56
+	if ( ! pxe_netdev ) {
57
+		DBGC ( image, "IMAGE %p could not locate PXE net device\n",
58
+		       image );
59
+		return -ENODEV;
60
+	}
61
+
55
 	/* Start PXE NBP */
62
 	/* Start PXE NBP */
56
 	rc = pxe_start_nbp();
63
 	rc = pxe_start_nbp();
57
 
64
 
80
 
87
 
81
 	/* Verify and prepare segment */
88
 	/* Verify and prepare segment */
82
 	if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
89
 	if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
83
-		DBG ( "PXE image could not prepare segment: %s\n",
84
-		      strerror ( rc ) );
90
+		DBGC ( image, "IMAGE %p could not prepare segment: %s\n",
91
+		       image, strerror ( rc ) );
85
 		return rc;
92
 		return rc;
86
 	}
93
 	}
87
 
94
 

Loading…
Cancel
Save