Jelajahi Sumber

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>
Colin Ian King 11 tahun lalu
induk
melakukan
39a85bcbfc
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      drivers/mfd/omap-usb-tll.c

+ 1 - 1
drivers/mfd/omap-usb-tll.c

@@ -252,7 +252,7 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 		break;
 	}
 
-	tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk * [tll->nch]),
+	tll->ch_clk = devm_kzalloc(dev, sizeof(struct clk *) * tll->nch,
 						GFP_KERNEL);
 	if (!tll->ch_clk) {
 		ret = -ENOMEM;