pinctrl: Drop error prints on kzalloc() failure

Upon failing kzalloc() will print an error message in the log, so
there's no need for additional printouts. Also standardizes the "!ptr"
vs "ptr == NULL" while I'm touching those lines.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Bjorn Andersson 2017-01-05 08:07:55 -08:00 committed by Linus Walleij
parent 476e3e1d05
commit 2104d12d11

View File

@ -237,10 +237,8 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
} }
pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL); pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL);
if (pindesc == NULL) { if (!pindesc)
dev_err(pctldev->dev, "failed to alloc struct pin_desc\n");
return -ENOMEM; return -ENOMEM;
}
/* Set owner */ /* Set owner */
pindesc->pctldev = pctldev; pindesc->pctldev = pctldev;
@ -882,11 +880,8 @@ static struct pinctrl_state *create_state(struct pinctrl *p,
struct pinctrl_state *state; struct pinctrl_state *state;
state = kzalloc(sizeof(*state), GFP_KERNEL); state = kzalloc(sizeof(*state), GFP_KERNEL);
if (state == NULL) { if (!state)
dev_err(p->dev,
"failed to alloc struct pinctrl_state\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
state->name = name; state->name = name;
INIT_LIST_HEAD(&state->settings); INIT_LIST_HEAD(&state->settings);
@ -913,11 +908,8 @@ static int add_setting(struct pinctrl *p, struct pinctrl_dev *pctldev,
return 0; return 0;
setting = kzalloc(sizeof(*setting), GFP_KERNEL); setting = kzalloc(sizeof(*setting), GFP_KERNEL);
if (setting == NULL) { if (!setting)
dev_err(p->dev,
"failed to alloc struct pinctrl_setting\n");
return -ENOMEM; return -ENOMEM;
}
setting->type = map->type; setting->type = map->type;
@ -997,10 +989,8 @@ static struct pinctrl *create_pinctrl(struct device *dev,
* a pin control handle with pinctrl_get() * a pin control handle with pinctrl_get()
*/ */
p = kzalloc(sizeof(*p), GFP_KERNEL); p = kzalloc(sizeof(*p), GFP_KERNEL);
if (p == NULL) { if (!p)
dev_err(dev, "failed to alloc struct pinctrl\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
p->dev = dev; p->dev = dev;
INIT_LIST_HEAD(&p->states); INIT_LIST_HEAD(&p->states);
INIT_LIST_HEAD(&p->dt_maps); INIT_LIST_HEAD(&p->dt_maps);
@ -1357,10 +1347,8 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps,
} }
maps_node = kzalloc(sizeof(*maps_node), GFP_KERNEL); maps_node = kzalloc(sizeof(*maps_node), GFP_KERNEL);
if (!maps_node) { if (!maps_node)
pr_err("failed to alloc struct pinctrl_maps\n");
return -ENOMEM; return -ENOMEM;
}
maps_node->num_maps = num_maps; maps_node->num_maps = num_maps;
if (dup) { if (dup) {
@ -1980,10 +1968,8 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL); pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
if (pctldev == NULL) { if (!pctldev)
dev_err(dev, "failed to alloc struct pinctrl_dev\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
/* Initialize pin control device struct */ /* Initialize pin control device struct */
pctldev->owner = pctldesc->owner; pctldev->owner = pctldesc->owner;