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,7 +38,7 @@ struct image_type pxe_image_type __image_type ( PROBE_PXE );
38 38
  * @v image		PXE image
39 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 42
 	struct net_device *netdev;
43 43
 	int rc;
44 44
 
@@ -52,6 +52,13 @@ static int pxe_exec ( struct image *image __unused ) {
52 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 62
 	/* Start PXE NBP */
56 63
 	rc = pxe_start_nbp();
57 64
 
@@ -80,8 +87,8 @@ int pxe_load ( struct image *image ) {
80 87
 
81 88
 	/* Verify and prepare segment */
82 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 92
 		return rc;
86 93
 	}
87 94
 

Loading…
Cancel
Save