summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/core.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-02-22 14:26:00 -0700
committerLinus Walleij <linus.walleij@linaro.org>2012-02-24 06:28:56 +0100
commit02f5b98951c631a3c4b3cc398dd2b14d274a6155 (patch)
tree357c026f464d5790833630eac6ac9bc78d4d2bf9 /drivers/pinctrl/core.c
parent95dcd4aea57f1d449305f3032240bba0a839593b (diff)
pinctrl: allocate sizeof(*p) instead of sizeof(struct foo)
This hopefully makes it harder to take the sizeof the wrong type. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r--drivers/pinctrl/core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 1d5943069a03..2cc8f727aedf 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -502,7 +502,7 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name)
* mapping, this is what consumers will get when requesting
* a pin control handle with pinctrl_get()
*/
- p = kzalloc(sizeof(struct pinctrl), GFP_KERNEL);
+ p = kzalloc(sizeof(*p), GFP_KERNEL);
if (p == NULL) {
dev_err(dev, "failed to alloc struct pinctrl\n");
return ERR_PTR(-ENOMEM);
@@ -726,7 +726,7 @@ static int pinctrl_hog_map(struct pinctrl_dev *pctldev,
struct pinctrl *p;
int ret;
- hog = kzalloc(sizeof(struct pinctrl_hog), GFP_KERNEL);
+ hog = kzalloc(sizeof(*hog), GFP_KERNEL);
if (!hog) {
dev_err(pctldev->dev, "failed to alloc struct pinctrl_hog\n");
return -ENOMEM;
@@ -1160,7 +1160,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
if (pctldesc->name == NULL)
return NULL;
- pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL);
+ pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
if (pctldev == NULL) {
dev_err(dev, "failed to alloc struct pinctrl_dev\n");
return NULL;