diff mbox

nvdimm: change to use generic kvfree()

Message ID 1440064809-26036-1-git-send-email-yalin.wang2010@gmail.com (mailing list archive)
State Accepted
Commit a06a7576526e
Headers show

Commit Message

yalin wang Aug. 20, 2015, 10 a.m. UTC
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
 drivers/nvdimm/dimm_devs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Ross Zwisler Aug. 20, 2015, 5:49 p.m. UTC | #1
On Thu, 2015-08-20 at 18:00 +0800, yalin wang wrote:
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> ---
>  drivers/nvdimm/dimm_devs.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
> index c05eb80..651b8d1 100644
> --- a/drivers/nvdimm/dimm_devs.c
> +++ b/drivers/nvdimm/dimm_devs.c
> @@ -241,10 +241,7 @@ void nvdimm_drvdata_release(struct kref *kref)
>  		nvdimm_free_dpa(ndd, res);
>  	nvdimm_bus_unlock(dev);
>  
> -	if (ndd->data && is_vmalloc_addr(ndd->data))
> -		vfree(ndd->data);
> -	else
> -		kfree(ndd->data);
> +	kvfree(ndd->data);
>  	kfree(ndd);
>  	put_device(dev);
>  }

This seems fine.  You're skipping the existing check to see if ndd->data is
NULL, but I think that is handled implicitly by is_vmalloc_addr() since NULL
won't be in the vmalloc address range.

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
diff mbox

Patch

diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index c05eb80..651b8d1 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -241,10 +241,7 @@  void nvdimm_drvdata_release(struct kref *kref)
 		nvdimm_free_dpa(ndd, res);
 	nvdimm_bus_unlock(dev);
 
-	if (ndd->data && is_vmalloc_addr(ndd->data))
-		vfree(ndd->data);
-	else
-		kfree(ndd->data);
+	kvfree(ndd->data);
 	kfree(ndd);
 	put_device(dev);
 }