[PATCH] bogus BUILD_BUG_ON() in bpa_iommu

Al Viro viro at ftp.linux.org.uk
Fri Sep 30 12:36:50 EST 2005


	BUILD_BUG_ON(1) is asking for trouble (and getting it) when used
in that manner - dead code elimination happens after we parse it and
invalid type is invalid type, dead code or not.
	It might be version-dependent, but at least 4.0.1 refuses to
accept that.
Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
----
diff -urN RC14-rc2-git6-base/arch/ppc64/kernel/bpa_iommu.c current/arch/ppc64/kernel/bpa_iommu.c
--- RC14-rc2-git6-base/arch/ppc64/kernel/bpa_iommu.c	2005-09-26 00:02:29.000000000 -0400
+++ current/arch/ppc64/kernel/bpa_iommu.c	2005-09-15 14:22:33.000000000 -0400
@@ -99,7 +99,11 @@
 		break;
 
 	default: /* not a known compile time constant */
-		BUILD_BUG_ON(1);
+		{
+			/* BUILD_BUG_ON() is not usable here */
+			extern void __get_iost_entry_bad_page_size(void);
+			__get_iost_entry_bad_page_size();
+		}
 		break;
 	}
 



More information about the Linuxppc64-dev mailing list