* [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()
@ 2017-04-25 6:57 Wei Yongjun
2017-04-25 8:13 ` Vivek Gautam
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2017-04-25 6:57 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Vivek Gautam; +Cc: Wei Yongjun, linux-kernel
From: Wei Yongjun <weiyongjun1@huawei.com>
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/phy/phy-qcom-qmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
index 727e23b..7d6085f 100644
--- a/drivers/phy/phy-qcom-qmp.c
+++ b/drivers/phy/phy-qcom-qmp.c
@@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev)
int num = qmp->cfg->num_vregs;
int i;
- qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL);
+ qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
if (!qmp->vregs)
return -ENOMEM;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()
2017-04-25 6:57 [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init() Wei Yongjun
@ 2017-04-25 8:13 ` Vivek Gautam
0 siblings, 0 replies; 2+ messages in thread
From: Vivek Gautam @ 2017-04-25 8:13 UTC (permalink / raw)
To: Wei Yongjun, Kishon Vijay Abraham I; +Cc: Wei Yongjun, linux-kernel
Hi,
On 04/25/2017 12:27 PM, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> sizeof() when applied to a pointer typed expression gives the
> size of the pointer, not that of the pointed data.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
Apparently Kbuild had caught this and sent a similar patch. But I missed
that.
Thank you for the patch. I have requested Kishon to pull in the patch
from Kbuild along with your patch [1] fixing the return value for of_iomap.
[1] https://lkml.org/lkml/2017/4/24/1080
Best Regards
Vivek
> drivers/phy/phy-qcom-qmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
> index 727e23b..7d6085f 100644
> --- a/drivers/phy/phy-qcom-qmp.c
> +++ b/drivers/phy/phy-qcom-qmp.c
> @@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev)
> int num = qmp->cfg->num_vregs;
> int i;
>
> - qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL);
> + qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
> if (!qmp->vregs)
> return -ENOMEM;
>
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-25 8:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 6:57 [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init() Wei Yongjun
2017-04-25 8:13 ` Vivek Gautam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).