mfd: omap-usb-tll: Fix cppcheck sizeof warning
authorColin Ian King <colin.king@canonical.com>
Tue, 11 Feb 2014 09:38:53 +0000 (09:38 +0000)
committerLee Jones <lee.jones@linaro.org>
Thu, 13 Mar 2014 22:21:48 +0000 (22:21 +0000)
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>
drivers/mfd/omap-usb-tll.c

index 5ee50f7..532eaca 100644 (file)
@@ -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;