Skip to contentSkip to conversation

clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

PATCH New Wei Yongjun 3 participants 3 messages Aug 22, 2016 – Aug 24, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

From: Wei Yongjun <[email protected]>

sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data.

---
 drivers/clk/meson/gxbb-aoclk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/gxbb-aoclk.c +1 -1
index 61ef28a..b45c5fb 100644
@@ -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;
 
#1 lore raw

PATCH 1/1 clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

Quoted 18 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data.

---
 drivers/clk/meson/gxbb-aoclk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/gxbb-aoclk.c +0 -0
index 61ef28a..b45c5fb 100644

drivers/clk/meson/gxbb-aoclk.c static int gxbb_aoclkc_probe(struct platform_device *pdev) · line 148

Quoted 8 lines
drivers/clk/meson/gxbb-aoclk.c +1 -1
@@ -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.

Also :

Fixes f8c11f79912d ("clk: meson: Add GXBB AO Clock and Reset controller driver")
Applied
#2 lore raw

PATCH 1/1 clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

In reply to Wei Yongjun
Quoted 7 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

sizeof() when applied to a pointer typed expression gives the size of the pointer, not that of the pointed data.

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project