regmap: prevent division by zero in rbtree_show
authorStephen Warren <swarren@nvidia.com>
Wed, 4 Apr 2012 21:48:33 +0000 (15:48 -0600)
committerVarun Wadekar <vwadekar@nvidia.com>
Wed, 18 Apr 2012 05:28:27 +0000 (10:28 +0530)
commit60f75035df3ea2dd9ef58e5a55afb365aa08e953
tree5f94ac0d7f40c4303eff70943dd0aa757b3c49a7
parent0e335e8126562bf5d7e5267fc2ac27769561428a
regmap: prevent division by zero in rbtree_show

If there are no nodes in the cache, nodes will be 0, so calculating
"registers / nodes" will cause division by zero.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
(cherry picked from commit c04c1b9ee8f30c7a3a25e20e406247003f634ebe)

Change-Id: I30047f1e0bd08417794c3d19e2fe1d480a74e083
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/96501
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
drivers/base/regmap/regcache-rbtree.c