2022-07-18 13:34:48

by Gaosheng Cui

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

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 <[email protected]>
---
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


2022-07-18 14:51:23

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH -next] nvmem: node: using put_device to replace kfree_const

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 <[email protected]>
> ---
> 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