* [U-Boot] [PATCH] reset: fix reset_get_bulk when phandle error
@ 2018-04-17 9:30 ` Neil Armstrong
0 siblings, 0 replies; 2+ messages in thread
From: Neil Armstrong @ 2018-04-17 9:30 UTC (permalink / raw)
To: u-boot
This fixes the Coverity Defect CID 175348 when dev_count_phandle_with_args()
returns a negative value.
Fixes: 0c28233903b5 ("reset: Add get/assert/deassert/release for bulk of reset signals")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/reset/reset-uclass.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index 9a5c9c9..fa4f653 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] reset: fix reset_get_bulk when phandle error
@ 2018-04-17 9:30 ` Neil Armstrong
0 siblings, 0 replies; 2+ messages in thread
From: Neil Armstrong @ 2018-04-17 9:30 UTC (permalink / raw)
To: linus-amlogic
This fixes the Coverity Defect CID 175348 when dev_count_phandle_with_args()
returns a negative value.
Fixes: 0c28233903b5 ("reset: Add get/assert/deassert/release for bulk of reset signals")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/reset/reset-uclass.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index 9a5c9c9..fa4f653 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-17 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 9:30 [U-Boot] [PATCH] reset: fix reset_get_bulk when phandle error Neil Armstrong
2018-04-17 9:30 ` Neil Armstrong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.