lkml.org 
[lkml]   [2014]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][v2] mfd: omap-usb-tll: fix cppcheck sizeof warning
On 02/11/2014 11:38 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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>
> ---
> drivers/mfd/omap-usb-tll.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
> index 5ee50f7..532eacab 100644
> --- a/drivers/mfd/omap-usb-tll.c
> +++ b/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;
>

Thanks for the patch Colin.

Acked-by: Roger Quadros <rogerq@ti.com>

--
cheers,
-roger


\
 
 \ /
  Last update: 2014-02-11 14:41    [W:0.040 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site