Commit 09e1cf82 authored by Markus Elfring's avatar Markus Elfring Committed by Krzysztof Kozlowski

ARM: SAMSUNG: Simplify size used for kzalloc

Simplify the size argument of kzalloc() memory allocation by using
sizeof(*ptr) syntax in adc.c and devs.c.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
[krzk: Rewrite commit message]
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
parent a3d1d8a7
...@@ -238,7 +238,7 @@ struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, ...@@ -238,7 +238,7 @@ struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
if (!pdev) if (!pdev)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
client = kzalloc(sizeof(struct s3c_adc_client), GFP_KERNEL); client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client) if (!client)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -342,7 +342,7 @@ static int s3c_adc_probe(struct platform_device *pdev) ...@@ -342,7 +342,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
int ret; int ret;
unsigned tmp; unsigned tmp;
adc = devm_kzalloc(dev, sizeof(struct adc_device), GFP_KERNEL); adc = devm_kzalloc(dev, sizeof(*adc), GFP_KERNEL);
if (!adc) if (!adc)
return -ENOMEM; return -ENOMEM;
......
...@@ -339,8 +339,7 @@ void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -339,8 +339,7 @@ void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 0; pd->bus_num = 0;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c0);
&s3c_device_i2c0);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c0_cfg_gpio; npd->cfg_gpio = s3c_i2c0_cfg_gpio;
...@@ -368,8 +367,7 @@ void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -368,8 +367,7 @@ void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 1; pd->bus_num = 1;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c1);
&s3c_device_i2c1);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c1_cfg_gpio; npd->cfg_gpio = s3c_i2c1_cfg_gpio;
...@@ -398,8 +396,7 @@ void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -398,8 +396,7 @@ void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 2; pd->bus_num = 2;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c2);
&s3c_device_i2c2);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c2_cfg_gpio; npd->cfg_gpio = s3c_i2c2_cfg_gpio;
...@@ -428,8 +425,7 @@ void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -428,8 +425,7 @@ void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 3; pd->bus_num = 3;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c3);
&s3c_device_i2c3);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c3_cfg_gpio; npd->cfg_gpio = s3c_i2c3_cfg_gpio;
...@@ -458,8 +454,7 @@ void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -458,8 +454,7 @@ void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 4; pd->bus_num = 4;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c4);
&s3c_device_i2c4);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c4_cfg_gpio; npd->cfg_gpio = s3c_i2c4_cfg_gpio;
...@@ -488,8 +483,7 @@ void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -488,8 +483,7 @@ void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 5; pd->bus_num = 5;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c5);
&s3c_device_i2c5);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c5_cfg_gpio; npd->cfg_gpio = s3c_i2c5_cfg_gpio;
...@@ -518,8 +512,7 @@ void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -518,8 +512,7 @@ void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 6; pd->bus_num = 6;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c6);
&s3c_device_i2c6);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c6_cfg_gpio; npd->cfg_gpio = s3c_i2c6_cfg_gpio;
...@@ -548,8 +541,7 @@ void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd) ...@@ -548,8 +541,7 @@ void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
pd->bus_num = 7; pd->bus_num = 7;
} }
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_i2c7);
&s3c_device_i2c7);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = s3c_i2c7_cfg_gpio; npd->cfg_gpio = s3c_i2c7_cfg_gpio;
...@@ -615,8 +607,7 @@ void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd) ...@@ -615,8 +607,7 @@ void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
{ {
struct samsung_keypad_platdata *npd; struct samsung_keypad_platdata *npd;
npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata), npd = s3c_set_platdata(pd, sizeof(*npd), &samsung_device_keypad);
&samsung_device_keypad);
if (!npd->cfg_gpio) if (!npd->cfg_gpio)
npd->cfg_gpio = samsung_keypad_cfg_gpio; npd->cfg_gpio = samsung_keypad_cfg_gpio;
...@@ -721,8 +712,7 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand) ...@@ -721,8 +712,7 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
* time then there is little chance the system is going to run. * time then there is little chance the system is going to run.
*/ */
npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand), npd = s3c_set_platdata(nand, sizeof(*npd), &s3c_device_nand);
&s3c_device_nand);
if (!npd) if (!npd)
return; return;
...@@ -1022,8 +1012,7 @@ void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd) ...@@ -1022,8 +1012,7 @@ void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd)
{ {
struct dwc2_hsotg_plat *npd; struct dwc2_hsotg_plat *npd;
npd = s3c_set_platdata(pd, sizeof(struct dwc2_hsotg_plat), npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_usb_hsotg);
&s3c_device_usb_hsotg);
if (!npd->phy_init) if (!npd->phy_init)
npd->phy_init = s5p_usb_phy_init; npd->phy_init = s5p_usb_phy_init;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment