[PATCH -next] nvmem: node: using put_device to replace kfree_const

Gaosheng Cui posted 1 patch 3 years, 9 months ago
drivers/base/node.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH -next] nvmem: node: using put_device to replace kfree_const
Posted by Gaosheng Cui 3 years, 9 months ago
We should never be touching the name pointer of a kobject
directly like this, the device structure itself should be
cleaning up the memory, not a kfree_const, so using put_device
to replace kfree_const.

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/base/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 0ac6376ef7a1..dd2c6089bed1 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -154,7 +154,7 @@ static struct node_access_nodes *node_init_node_access(struct node *node,
 	list_add_tail(&access_node->list_node, &node->access_list);
 	return access_node;
 free_name:
-	kfree_const(dev->kobj.name);
+	put_device(&access_node->dev);
 free:
 	kfree(access_node);
 	return NULL;
-- 
2.25.1
Re: [PATCH -next] nvmem: node: using put_device to replace kfree_const
Posted by Greg KH 3 years, 9 months ago
On Mon, Jul 18, 2022 at 09:06:12PM +0800, Gaosheng Cui wrote:
> We should never be touching the name pointer of a kobject
> directly like this, the device structure itself should be
> cleaning up the memory, not a kfree_const, so using put_device
> to replace kfree_const.
> 
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/base/node.c | 2 +-

Please slow down.

Your subject does not match the file name you changed.  Stop and wait a
few days, fix up your patches based on the review, and send a patch
series and then wait for others to review them.

While you wait, take some time and review patches from others, so that
you can get some experience here.

good luck

greg k-h