提交 0b88bc92 编写于 作者: S Stephen Boyd

clk: ti: Use int to check return value from of_property_count_elems_of_size()

This function can return a negative number when it fails, but res->sets
is at most a u16 which can't hold that negative number. Let's store the
result into an int, ret, and then assign that to res->sets when it works
to avoid this logical impossibility.
Signed-off-by: NStephen Boyd <sboyd@kernel.org>
上级 0af69227
...@@ -2402,12 +2402,13 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle, ...@@ -2402,12 +2402,13 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
if (!res) if (!res)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
res->sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop, ret = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
sizeof(u32)); sizeof(u32));
if (res->sets < 0) { if (ret < 0) {
dev_err(dev, "%s resource type ids not available\n", of_prop); dev_err(dev, "%s resource type ids not available\n", of_prop);
return ERR_PTR(res->sets); return ERR_PTR(ret);
} }
res->sets = ret;
res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc), res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
GFP_KERNEL); GFP_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册