diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-04-26 03:50:34 -0400 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2017-05-15 02:59:08 -0400 |
commit | aa248927d8dbaa35e0fb920f30d0da2164dc7a98 (patch) | |
tree | 550a86ed89e7cd077efe303485703d46936ce58d | |
parent | 2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff) |
reset: sti: Use devm_kcalloc() in syscfg_reset_controller_register()
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kcalloc".
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
* Delete the local variable "size" which became unnecessary with
this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r-- | drivers/reset/sti/reset-syscfg.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c index 9bd57a5eee72..7e0f2aa55ba7 100644 --- a/drivers/reset/sti/reset-syscfg.c +++ b/drivers/reset/sti/reset-syscfg.c | |||
@@ -145,16 +145,14 @@ static int syscfg_reset_controller_register(struct device *dev, | |||
145 | const struct syscfg_reset_controller_data *data) | 145 | const struct syscfg_reset_controller_data *data) |
146 | { | 146 | { |
147 | struct syscfg_reset_controller *rc; | 147 | struct syscfg_reset_controller *rc; |
148 | size_t size; | ||
149 | int i, err; | 148 | int i, err; |
150 | 149 | ||
151 | rc = devm_kzalloc(dev, sizeof(*rc), GFP_KERNEL); | 150 | rc = devm_kzalloc(dev, sizeof(*rc), GFP_KERNEL); |
152 | if (!rc) | 151 | if (!rc) |
153 | return -ENOMEM; | 152 | return -ENOMEM; |
154 | 153 | ||
155 | size = sizeof(struct syscfg_reset_channel) * data->nr_channels; | 154 | rc->channels = devm_kcalloc(dev, data->nr_channels, |
156 | 155 | sizeof(*rc->channels), GFP_KERNEL); | |
157 | rc->channels = devm_kzalloc(dev, size, GFP_KERNEL); | ||
158 | if (!rc->channels) | 156 | if (!rc->channels) |
159 | return -ENOMEM; | 157 | return -ENOMEM; |
160 | 158 | ||