Skip to content

Commit

Permalink
ptp_ocp: replace kzalloc(x*y) by kcalloc(y, x)
Browse files Browse the repository at this point in the history
While here it may be no difference, the kcalloc() has some checks
against overflow and it's logically correct to call it for an array.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Vadim Fedorenko <vfedorenko@novek.ru>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Andy Shevchenko authored and Jakub Kicinski committed Jun 10, 2022
1 parent 0fb0bf7 commit 9a7a1be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ptp/ptp_ocp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ ptp_ocp_fb_set_pins(struct ptp_ocp *bp)
struct ptp_pin_desc *config;
int i;

config = kzalloc(sizeof(*config) * 4, GFP_KERNEL);
config = kcalloc(4, sizeof(*config), GFP_KERNEL);
if (!config)
return -ENOMEM;

Expand Down

0 comments on commit 9a7a1be

Please sign in to comment.