reset: sti: kzalloc + kcalloc to kzalloc
Simplify allocation. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
62d11b80ea
commit
223af4a569
1 changed files with 2 additions and 7 deletions
|
|
@ -41,7 +41,7 @@ struct syscfg_reset_channel {
|
|||
struct syscfg_reset_controller {
|
||||
struct reset_controller_dev rst;
|
||||
bool active_low;
|
||||
struct syscfg_reset_channel *channels;
|
||||
struct syscfg_reset_channel channels[];
|
||||
};
|
||||
|
||||
#define to_syscfg_reset_controller(_rst) \
|
||||
|
|
@ -135,15 +135,10 @@ static int syscfg_reset_controller_register(struct device *dev,
|
|||
struct syscfg_reset_controller *rc;
|
||||
int i, err;
|
||||
|
||||
rc = devm_kzalloc(dev, sizeof(*rc), GFP_KERNEL);
|
||||
rc = devm_kzalloc(dev, struct_size(rc, channels, data->nr_channels), GFP_KERNEL);
|
||||
if (!rc)
|
||||
return -ENOMEM;
|
||||
|
||||
rc->channels = devm_kcalloc(dev, data->nr_channels,
|
||||
sizeof(*rc->channels), GFP_KERNEL);
|
||||
if (!rc->channels)
|
||||
return -ENOMEM;
|
||||
|
||||
rc->rst.ops = &syscfg_reset_ops;
|
||||
rc->rst.of_node = dev->of_node;
|
||||
rc->rst.nr_resets = data->nr_channels;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue