diff options
author | Guo Zhengkui <guozhengkui@vivo.com> | 2021-12-09 04:21:14 +0100 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2021-12-09 12:54:54 +0100 |
commit | e87f13c33e126ab2c72f9acb5ae98fbb93ddfd32 (patch) | |
tree | 22a22b89bc63bf767e111e87fe289d105e86e6c1 /drivers/phy | |
parent | phy: qcom-qmp: Add SM8450 UFS QMP Phy (diff) | |
download | linux-e87f13c33e126ab2c72f9acb5ae98fbb93ddfd32.tar.xz linux-e87f13c33e126ab2c72f9acb5ae98fbb93ddfd32.zip |
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>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/qualcomm/phy-qcom-edp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c index 17d5653b661d..a8ecd2e8442d 100644 --- a/drivers/phy/qualcomm/phy-qcom-edp.c +++ b/drivers/phy/qualcomm/phy-qcom-edp.c @@ -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; |