Message ID | 1527518174-27860-1-git-send-email-rogerq@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c index cb2ee96..e98d221 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c @@ -36,11 +36,11 @@ static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count) struct device_node *np = dev->of_node; int i; - simple->num_clocks = count; - - if (!count) + if (count <= 0) return 0; + simple->num_clocks = count; + simple->clks = devm_kcalloc(dev, simple->num_clocks, sizeof(struct clk *), GFP_KERNEL); if (!simple->clks)
of_count_phandle_with_args() returns -ENOENT (-2) if there are no clock entries. Don't fail in such a case. Signed-off-by: Roger Quadros <rogerq@ti.com> --- drivers/usb/dwc3/dwc3-of-simple.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)