Commit 02f5b989 authored by Stephen Warren's avatar Stephen Warren Committed by Linus Walleij

pinctrl: allocate sizeof(*p) instead of sizeof(struct foo)

This hopefully makes it harder to take the sizeof the wrong type.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarDong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 95dcd4ae
...@@ -502,7 +502,7 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name) ...@@ -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 * mapping, this is what consumers will get when requesting
* a pin control handle with pinctrl_get() * a pin control handle with pinctrl_get()
*/ */
p = kzalloc(sizeof(struct pinctrl), GFP_KERNEL); p = kzalloc(sizeof(*p), GFP_KERNEL);
if (p == NULL) { if (p == NULL) {
dev_err(dev, "failed to alloc struct pinctrl\n"); dev_err(dev, "failed to alloc struct pinctrl\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -726,7 +726,7 @@ static int pinctrl_hog_map(struct pinctrl_dev *pctldev, ...@@ -726,7 +726,7 @@ static int pinctrl_hog_map(struct pinctrl_dev *pctldev,
struct pinctrl *p; struct pinctrl *p;
int ret; int ret;
hog = kzalloc(sizeof(struct pinctrl_hog), GFP_KERNEL); hog = kzalloc(sizeof(*hog), GFP_KERNEL);
if (!hog) { if (!hog) {
dev_err(pctldev->dev, "failed to alloc struct pinctrl_hog\n"); dev_err(pctldev->dev, "failed to alloc struct pinctrl_hog\n");
return -ENOMEM; return -ENOMEM;
...@@ -1160,7 +1160,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, ...@@ -1160,7 +1160,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
if (pctldesc->name == NULL) if (pctldesc->name == NULL)
return NULL; return NULL;
pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL); pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
if (pctldev == NULL) { if (pctldev == NULL) {
dev_err(dev, "failed to alloc struct pinctrl_dev\n"); dev_err(dev, "failed to alloc struct pinctrl_dev\n");
return NULL; return NULL;
......
...@@ -491,7 +491,7 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev, ...@@ -491,7 +491,7 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev,
p->func_selector = func_selector; p->func_selector = func_selector;
/* Now add this group selector, we may have many of them */ /* Now add this group selector, we may have many of them */
grp = kmalloc(sizeof(struct pinmux_group), GFP_KERNEL); grp = kmalloc(sizeof(*grp), GFP_KERNEL);
if (!grp) if (!grp)
return -ENOMEM; return -ENOMEM;
grp->group_selector = group_selector; grp->group_selector = group_selector;
......
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