Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: omap-usb-tll: Fix cppcheck sizeof warning

Static analysis from cppcheck issued the following warning:

[drivers/mfd/omap-usb-tll.c:255]: (warning) Found calculation
inside sizeof().

The current size calculation is not obvious and is easy to
miscomprehend, so re-work the size of the allocation based
on the size of the struct pointer and quantity to allocate.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Colin Ian King and committed by
Lee Jones
39a85bcb 0414855f

+1 -1
+1 -1
drivers/mfd/omap-usb-tll.c
··· 252 252 break; 253 253 } 254 254 255 - tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk * [tll->nch]), 255 + tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk *) * tll->nch, 256 256 GFP_KERNEL); 257 257 if (!tll->ch_clk) { 258 258 ret = -ENOMEM;