Skip to contentSkip to conversation

drivers/block/nbd.c: don't defer compile error to runtime

PATCH New Adrian Bunk 1 participant 1 message Feb 20, 2006

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

PATCH 1/1 drivers/block/nbd.c: don't defer compile error to runtime

If we can detect a problem at compile time, the compilation should fail.

---

This patch was already sent on:
- 3 Sep 2005

drivers/block/nbd.c renamed from drivers/block/nbd.c.old +1 -4
@@ -643,10 +643,7 @@
 	int err = -ENOMEM;
 	int i;
 
-	if (sizeof(struct nbd_request) != 28) {
-		printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" );
-		return -EIO;
-	}
+	BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
 
 	if (nbds_max > MAX_NBD) {
 		printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD,