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.

Fixes: 0c28233903 ("reset: Add get/assert/deassert/release for bulk of reset signals")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2018-04-17 11:30:22 +02:00 committed by Tom Rini
parent 34b3722e38
commit 895a82ce90

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);