diff mbox

[-next] clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

Message ID 1471882101-22347-1-git-send-email-weiyj.lk@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

Wei Yongjun Aug. 22, 2016, 4:08 p.m. UTC
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/clk/meson/gxbb-aoclk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Neil Armstrong Aug. 23, 2016, 7:58 a.m. UTC | #1
On 08/22/2016 06:08 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>
> ---
>  drivers/clk/meson/gxbb-aoclk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/meson/gxbb-aoclk.c b/drivers/clk/meson/gxbb-aoclk.c
> index 61ef28a..b45c5fb 100644
> --- a/drivers/clk/meson/gxbb-aoclk.c
> +++ b/drivers/clk/meson/gxbb-aoclk.c
> @@ -142,7 +142,7 @@ static int gxbb_aoclkc_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct gxbb_aoclk_reset_controller *rstc;
>  
> -	rstc = devm_kzalloc(dev, sizeof(rstc), GFP_KERNEL);
> +	rstc = devm_kzalloc(dev, sizeof(*rstc), GFP_KERNEL);
>  	if (!rstc)
>  		return -ENOMEM;
>  
> 
> 
> 

Aww, my bad.

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Also :
Fixes: f8c11f79912d ("clk: meson: Add GXBB AO Clock and Reset controller driver")
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Aug. 24, 2016, 5:29 p.m. UTC | #2
On 08/22, 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>
> ---

Applied to clk-next
diff mbox

Patch

diff --git a/drivers/clk/meson/gxbb-aoclk.c b/drivers/clk/meson/gxbb-aoclk.c
index 61ef28a..b45c5fb 100644
--- a/drivers/clk/meson/gxbb-aoclk.c
+++ b/drivers/clk/meson/gxbb-aoclk.c
@@ -142,7 +142,7 @@  static int gxbb_aoclkc_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct gxbb_aoclk_reset_controller *rstc;
 
-	rstc = devm_kzalloc(dev, sizeof(rstc), GFP_KERNEL);
+	rstc = devm_kzalloc(dev, sizeof(*rstc), GFP_KERNEL);
 	if (!rstc)
 		return -ENOMEM;