提交 e87f13c3 编写于 作者: G Guo Zhengkui 提交者: Vinod Koul

phy: qcom: use struct_size instead of sizeof

Use struct_size() to get the accurate size of `clk_hw_onecell_data`
with a variable size array, instead of sizeof(data) to get the size
of a pointer.
Suggested-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: NGuo Zhengkui <guozhengkui@vivo.com>
Fixes: f199223c ("phy: qcom: Introduce new eDP PHY driver")
Reviewed-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211209032114.9416-1-guozhengkui@vivo.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
上级 15aa1f66
......@@ -571,7 +571,7 @@ static int qcom_edp_clks_register(struct qcom_edp *edp, struct device_node *np)
struct clk_init_data init = { };
int ret;
data = devm_kzalloc(edp->dev, sizeof(data), GFP_KERNEL);
data = devm_kzalloc(edp->dev, struct_size(data, hws, 2), GFP_KERNEL);
if (!data)
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册