Skip to content

Commit

Permalink
nvmem: brcm_nvram: Use kzalloc for allocating only one element
Browse files Browse the repository at this point in the history
Use kzalloc(...) rather than kcalloc(1, ...) because the number of
elements we are specifying in this case is 1, so kzalloc would
accomplish the same thing and we can simplify.

Signed-off-by: Kenneth Lee <klee33@uw.edu>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kenneth Lee authored and Greg Kroah-Hartman committed Sep 24, 2022
1 parent ff1df18 commit d3524bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvmem/brcm_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int brcm_nvram_parse(struct brcm_nvram *priv)

len = le32_to_cpu(header.len);

data = kcalloc(1, len, GFP_KERNEL);
data = kzalloc(len, GFP_KERNEL);
memcpy_fromio(data, priv->base, len);
data[len - 1] = '\0';

Expand Down

0 comments on commit d3524bb

Please sign in to comment.