scripts/dtc: Update to upstream commit b06e55c88b9b
[linux-2.6-block.git] / scripts / dtc / dtc-parser.y
index 5a897e36562d67107dba44fa91274253b34152dc..000873f070fdcf3e4a11618cbfefdccb0d8e6cf9 100644 (file)
@@ -410,8 +410,24 @@ integer_add:
 
 integer_mul:
          integer_mul '*' integer_unary { $$ = $1 * $3; }
-       | integer_mul '/' integer_unary { $$ = $1 / $3; }
-       | integer_mul '%' integer_unary { $$ = $1 % $3; }
+       | integer_mul '/' integer_unary
+               {
+                       if ($3 != 0) {
+                               $$ = $1 / $3;
+                       } else {
+                               ERROR(&@$, "Division by zero");
+                               $$ = 0;
+                       }
+               }
+       | integer_mul '%' integer_unary
+               {
+                       if ($3 != 0) {
+                               $$ = $1 % $3;
+                       } else {
+                               ERROR(&@$, "Division by zero");
+                               $$ = 0;
+                       }
+               }
        | integer_unary
        ;