LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply
@ 2015-01-20  2:42 Chase Southwood
  2015-01-20 11:04 ` Ian Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: Chase Southwood @ 2015-01-20  2:42 UTC (permalink / raw)
  To: gregkh; +Cc: abbotti, hsweeten, devel, linux-kernel, Chase Southwood

Checkpatch doesn't like kmalloc with multiply very much:
drivers/staging/comedi/drivers/das1800.c:1377: WARNING: Prefer kmalloc_array over kmalloc with multiply

So this patch swaps that use out for kmalloc_array instead.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
---
 drivers/staging/comedi/drivers/das1800.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 381ae94..13ed31c 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1374,7 +1374,7 @@ static int das1800_attach(struct comedi_device *dev,
 	if (dev->irq & it->options[2])
 		das1800_init_dma(dev, it);
 
-	devpriv->fifo_buf = kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL);
+	devpriv->fifo_buf = kmalloc_array(FIFO_SIZE, sizeof(uint16_t), GFP_KERNEL);
 	if (!devpriv->fifo_buf)
 		return -ENOMEM;
 
-- 
2.2.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply
  2015-01-20  2:42 [PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply Chase Southwood
@ 2015-01-20 11:04 ` Ian Abbott
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Abbott @ 2015-01-20 11:04 UTC (permalink / raw)
  To: Chase Southwood, gregkh; +Cc: hsweeten, devel, linux-kernel

On 20/01/15 02:42, Chase Southwood wrote:
> Checkpatch doesn't like kmalloc with multiply very much:
> drivers/staging/comedi/drivers/das1800.c:1377: WARNING: Prefer kmalloc_array over kmalloc with multiply
>
> So this patch swaps that use out for kmalloc_array instead.
>
> Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
> ---
>   drivers/staging/comedi/drivers/das1800.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
> index 381ae94..13ed31c 100644
> --- a/drivers/staging/comedi/drivers/das1800.c
> +++ b/drivers/staging/comedi/drivers/das1800.c
> @@ -1374,7 +1374,7 @@ static int das1800_attach(struct comedi_device *dev,
>   	if (dev->irq & it->options[2])
>   		das1800_init_dma(dev, it);
>
> -	devpriv->fifo_buf = kmalloc(FIFO_SIZE * sizeof(uint16_t), GFP_KERNEL);
> +	devpriv->fifo_buf = kmalloc_array(FIFO_SIZE, sizeof(uint16_t), GFP_KERNEL);
>   	if (!devpriv->fifo_buf)
>   		return -ENOMEM;
>
>

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-20 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20  2:42 [PATCH] staging: comedi: das1800: prefer kmalloc_array over kmalloc with multiply Chase Southwood
2015-01-20 11:04 ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).