# \[PATCH\] pyh: qcom: fix the application of sizeof to pointer

- Subsystems: GENERIC PHY FRAMEWORK, ARM/QUALCOMM MAILING LIST, THE REST
- Maintainers: Vinod Koul, Linus Torvalds
- List: linux-phy
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-phy/2021/12/1600566/t

## \[PATCH\] pyh: qcom: fix the application of sizeof to pointer

- From: \<hidden\>
- Date: 2021-12-08 01:03:42 
- Message: https://ratatoskr.run/linux-phy/2021/12/1600566.md

```text
From: David Yang <redacted>

The coccinelle check report:
./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
ERROR: application of sizeof to pointer

Using the real size to fix it.

Reported-by: Zeal Robot <redacted>
Signed-off-by: Yang Guang <redacted>
Signed-off-by: David Yang <redacted>
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
index 17d5653b661d..5fe4eab9cac1 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, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-- 
2.30.2


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
```

## Re: \[PATCH\] pyh: qcom: fix the application of sizeof to pointer

- From: Bjorn Andersson \<hidden\>
- Date: 2021-12-08 05:15:07 
- Message: https://ratatoskr.run/linux-phy/2021/12/1600760.md

```text
On Tue 07 Dec 17:03 PST 2021, davidcomponentone@gmail.com wrote:

> From: David Yang <redacted>
> 
> The coccinelle check report:
> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> ERROR: application of sizeof to pointer
> 
> Using the real size to fix it.
> 

Thanks for the fix David.

Please see my answer here
https://lore.kernel.org/all/Ya96KOynsO478cVx@ripper/

Regards,
Bjorn

> Reported-by: Zeal Robot <redacted>
> Signed-off-by: Yang Guang <redacted>
> Signed-off-by: David Yang <redacted>
> ---
>  drivers/phy/qualcomm/phy-qcom-edp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
> index 17d5653b661d..5fe4eab9cac1 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, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> -- 
> 2.30.2
> 

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
```
