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: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver") Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211209032114.9416-1-guozhengkui@vivo.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
15aa1f668c
commit
e87f13c33e
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user