Re: [PATCH] nvdimm: change to use generic kvfree()

From: Ross Zwisler
Date: Thu Aug 20 2015 - 13:50:00 EST


On Thu, 2015-08-20 at 18:00 +0800, yalin wang wrote:
> Signed-off-by: yalin wang <yalin.wang2010@xxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxx>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/