From: Bartosz Golaszewski Date: Fri, 16 Sep 2016 16:02:44 +0000 (+0200) Subject: i2c: add a warning to i2c_adapter_depth() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2771dc34ddaa313127d6431f23ae4cea26b869b0;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git i2c: add a warning to i2c_adapter_depth() This routine is only used together with lockdep for nested locking. The number of lock subclasses is limited to 8 as defined in lockdep.h Emit a warning if the adapter depth exceeds the maximum number of lockdep subclasses. Signed-off-by: Bartosz Golaszewski Acked-by: Peter Rosin Acked-by: Peter Zijlstra (Intel) Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 981de21ab814..98fffa3a09f7 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1433,6 +1433,9 @@ unsigned int i2c_adapter_depth(struct i2c_adapter *adapter) while ((adapter = i2c_parent_is_i2c_adapter(adapter))) depth++; + WARN_ONCE(depth >= MAX_LOCKDEP_SUBCLASSES, + "adapter depth exceeds lockdep subclass limit\n"); + return depth; } EXPORT_SYMBOL_GPL(i2c_adapter_depth);