UPSTREAM: reset: fix reset_get_bulk when phandle error

This fixes the Coverity Defect CID 175348 when dev_count_phandle_with_args()
returns a negative value.

Change-Id: I3572567e0dce19548a970ecf4e446ff9b23b895f
Fixes: 0c28233903b5 ("reset: Add get/assert/deassert/release for bulk of reset signals")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 895a82ce90278130828b26c230da99331a33e729)
This commit is contained in:
Neil Armstrong 2018-04-17 11:30:22 +02:00 committed by Jianhong Chen
parent 94fbbf0f6d
commit 989a41fcc4
1 changed files with 2 additions and 2 deletions

View File

@ -88,8 +88,8 @@ int reset_get_bulk(struct udevice *dev, struct reset_ctl_bulk *bulk)
bulk->count = 0;
count = dev_count_phandle_with_args(dev, "resets", "#reset-cells");
if (!count)
return 0;
if (count < 1)
return count;
bulk->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl),
GFP_KERNEL);