* drivers/staging/kpc2000/kpc_dma/fileops.c:60:8-26: WARNING: casting value returned by memory allocation function to (struct aio_cb_data *) is useless.
@ 2019-05-15 12:16 kbuild test robot
2019-05-15 12:16 ` [PATCH] staging: kpc2000: fix alloc_cast.cocci warnings kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-05-15 12:16 UTC (permalink / raw)
To: Matt Sickler; +Cc: kbuild-all, linux-kernel, Greg Kroah-Hartman
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5ac94332248ee017964ba368cdda4ce647e3aba7
commit: 7df95299b94a63ec67a6389fc02dc25019a80ee8 staging: kpc2000: Add DMA driver
date: 3 weeks ago
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
coccinelle warnings: (new ones prefixed by >>)
>> drivers/staging/kpc2000/kpc_dma/fileops.c:60:8-26: WARNING: casting value returned by memory allocation function to (struct aio_cb_data *) is useless.
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: kpc2000: fix alloc_cast.cocci warnings
2019-05-15 12:16 drivers/staging/kpc2000/kpc_dma/fileops.c:60:8-26: WARNING: casting value returned by memory allocation function to (struct aio_cb_data *) is useless kbuild test robot
@ 2019-05-15 12:16 ` kbuild test robot
2019-05-15 13:16 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-05-15 12:16 UTC (permalink / raw)
To: Matt Sickler; +Cc: kbuild-all, linux-kernel, Greg Kroah-Hartman
From: kbuild test robot <lkp@intel.com>
drivers/staging/kpc2000/kpc_dma/fileops.c:60:8-26: WARNING: casting value returned by memory allocation function to (struct aio_cb_data *) is useless.
Remove casting the values returned by memory allocation functions
like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
Semantic patch information:
This makes an effort to find cases of casting of values returned by
kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
the casting as it is not required. The result in the patch case may
need some reformatting.
Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci
Fixes: 7df95299b94a ("staging: kpc2000: Add DMA driver")
CC: Matt Sickler <Matt.Sickler@daktronics.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5ac94332248ee017964ba368cdda4ce647e3aba7
commit: 7df95299b94a63ec67a6389fc02dc25019a80ee8 staging: kpc2000: Add DMA driver
fileops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -57,7 +57,7 @@ int kpc_dma_transfer(struct dev_private
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_transfer(priv = [%p], kcb = [%p], iov_base = [%p], iov_len = %ld) ldev = [%p]\n", priv, kcb, (void*)iov_base, iov_len, ldev);
- acd = (struct aio_cb_data *) kzalloc(sizeof(struct aio_cb_data), GFP_KERNEL);
+ acd = kzalloc(sizeof(struct aio_cb_data), GFP_KERNEL);
if (!acd){
dev_err(&priv->ldev->pldev->dev, "Couldn't kmalloc space for for the aio data\n");
return -ENOMEM;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: kpc2000: fix alloc_cast.cocci warnings
2019-05-15 12:16 ` [PATCH] staging: kpc2000: fix alloc_cast.cocci warnings kbuild test robot
@ 2019-05-15 13:16 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-15 13:16 UTC (permalink / raw)
To: kbuild test robot; +Cc: Matt Sickler, kbuild-all, linux-kernel
On Wed, May 15, 2019 at 08:16:15PM +0800, kbuild test robot wrote:
> From: kbuild test robot <lkp@intel.com>
>
> drivers/staging/kpc2000/kpc_dma/fileops.c:60:8-26: WARNING: casting value returned by memory allocation function to (struct aio_cb_data *) is useless.
>
> Remove casting the values returned by memory allocation functions
> like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
>
> Semantic patch information:
> This makes an effort to find cases of casting of values returned by
> kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
> kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
> the casting as it is not required. The result in the patch case may
> need some reformatting.
>
> Generated by: scripts/coccinelle/api/alloc/alloc_cast.cocci
>
> Fixes: 7df95299b94a ("staging: kpc2000: Add DMA driver")
> CC: Matt Sickler <Matt.Sickler@daktronics.com>
> Signed-off-by: kbuild test robot <lkp@intel.com>
> ---
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 5ac94332248ee017964ba368cdda4ce647e3aba7
> commit: 7df95299b94a63ec67a6389fc02dc25019a80ee8 staging: kpc2000: Add DMA driver
>
> fileops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/staging/kpc2000/kpc_dma/fileops.c
> +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
> @@ -57,7 +57,7 @@ int kpc_dma_transfer(struct dev_private
>
> dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_transfer(priv = [%p], kcb = [%p], iov_base = [%p], iov_len = %ld) ldev = [%p]\n", priv, kcb, (void*)iov_base, iov_len, ldev);
>
> - acd = (struct aio_cb_data *) kzalloc(sizeof(struct aio_cb_data), GFP_KERNEL);
> + acd = kzalloc(sizeof(struct aio_cb_data), GFP_KERNEL);
> if (!acd){
> dev_err(&priv->ldev->pldev->dev, "Couldn't kmalloc space for for the aio data\n");
> return -ENOMEM;
Already fixed in my staging-testing branch, thanks.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-15 13:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-15 12:16 drivers/staging/kpc2000/kpc_dma/fileops.c:60:8-26: WARNING: casting value returned by memory allocation function to (struct aio_cb_data *) is useless kbuild test robot
2019-05-15 12:16 ` [PATCH] staging: kpc2000: fix alloc_cast.cocci warnings kbuild test robot
2019-05-15 13:16 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox