From 979a7cc627bf59606f50fe7870a5380300c5a55f Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Thu, 20 Dec 2012 15:05:42 -0800 Subject: [PATCH] --- yaml --- r: 347885 b: refs/heads/master c: c4e18497d8fd92eef2c6e7eadcc1a107ccd115ea h: refs/heads/master i: 347883: eb409055d4bd425795bd73f48d8f1fbe89595dd8 v: v3 --- [refs] | 2 +- trunk/include/linux/kernel.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 066df1d25017..2370dded5108 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 154b454edaf6d94a69016db6c342c57fa935bbe9 +refs/heads/master: c4e18497d8fd92eef2c6e7eadcc1a107ccd115ea diff --git a/trunk/include/linux/kernel.h b/trunk/include/linux/kernel.h index d140e8fb075f..c566927efcbd 100644 --- a/trunk/include/linux/kernel.h +++ b/trunk/include/linux/kernel.h @@ -77,13 +77,15 @@ /* * Divide positive or negative dividend by positive divisor and round - * to closest integer. Result is undefined for negative divisors. + * to closest integer. Result is undefined for negative divisors and + * for negative dividends if the divisor variable type is unsigned. */ #define DIV_ROUND_CLOSEST(x, divisor)( \ { \ typeof(x) __x = x; \ typeof(divisor) __d = divisor; \ - (((typeof(x))-1) > 0 || (__x) > 0) ? \ + (((typeof(x))-1) > 0 || \ + ((typeof(divisor))-1) > 0 || (__x) > 0) ? \ (((__x) + ((__d) / 2)) / (__d)) : \ (((__x) - ((__d) / 2)) / (__d)); \ } \