* [PATCH] skd: Use kmem_cache_free
@ 2017-10-08 21:30 Himanshu Jha
2017-10-09 14:31 ` Jens Axboe
2017-10-09 17:33 ` Bart Van Assche
0 siblings, 2 replies; 3+ messages in thread
From: Himanshu Jha @ 2017-10-08 21:30 UTC (permalink / raw)
To: bart.vanassche; +Cc: linux-block, linux-kernel, Himanshu Jha
Use kmem_cache_free instead of kfree for freeing the memory previously
allocated with kmem_cache_zalloc/kmem_cache_alloc/kmem_cache_node.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
drivers/block/skd_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 7cedb42..64d0fc1 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -2604,7 +2604,7 @@ static void *skd_alloc_dma(struct skd_device *skdev, struct kmem_cache *s,
return NULL;
*dma_handle = dma_map_single(dev, buf, s->size, dir);
if (dma_mapping_error(dev, *dma_handle)) {
- kfree(buf);
+ kmem_cache_free(s, buf);
buf = NULL;
}
return buf;
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] skd: Use kmem_cache_free
2017-10-08 21:30 [PATCH] skd: Use kmem_cache_free Himanshu Jha
@ 2017-10-09 14:31 ` Jens Axboe
2017-10-09 17:33 ` Bart Van Assche
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-10-09 14:31 UTC (permalink / raw)
To: Himanshu Jha, bart.vanassche; +Cc: linux-block, linux-kernel
On 10/08/2017 03:30 PM, Himanshu Jha wrote:
> Use kmem_cache_free instead of kfree for freeing the memory previously
> allocated with kmem_cache_zalloc/kmem_cache_alloc/kmem_cache_node.
Good catch, I wonder how long that's been there... Applied for 4.14.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] skd: Use kmem_cache_free
2017-10-08 21:30 [PATCH] skd: Use kmem_cache_free Himanshu Jha
2017-10-09 14:31 ` Jens Axboe
@ 2017-10-09 17:33 ` Bart Van Assche
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2017-10-09 17:33 UTC (permalink / raw)
To: himanshujha199640; +Cc: linux-kernel, linux-block
On Mon, 2017-10-09 at 03:00 +0530, Himanshu Jha wrote:
> Use kmem_cache_free instead of kfree for freeing the memory previously
> allocated with kmem_cache_zalloc/kmem_cache_alloc/kmem_cache_node.
>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
> drivers/block/skd_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> index 7cedb42..64d0fc1 100644
> --- a/drivers/block/skd_main.c
> +++ b/drivers/block/skd_main.c
> @@ -2604,7 +2604,7 @@ static void *skd_alloc_dma(struct skd_device *skdev, struct kmem_cache *s,
> return NULL;
> *dma_handle = dma_map_single(dev, buf, s->size, dir);
> if (dma_mapping_error(dev, *dma_handle)) {
> - kfree(buf);
> + kmem_cache_free(s, buf);
> buf = NULL;
> }
> return buf;
Thanks for this patch.
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-09 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 21:30 [PATCH] skd: Use kmem_cache_free Himanshu Jha
2017-10-09 14:31 ` Jens Axboe
2017-10-09 17:33 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome