Commit e87f13c3 authored by Guo Zhengkui's avatar Guo Zhengkui Committed by Vinod Koul
Browse files

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: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarGuo Zhengkui <guozhengkui@vivo.com>
Fixes: f199223c ("phy: qcom: Introduce new eDP PHY driver")
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211209032114.9416-1-guozhengkui@vivo.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 15aa1f66
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;