gpio: rockchip: Fix missing of_node_put() in rockchip_gpio_probe() and rockchip_gpiolib_register()
Subsystems (2)
PATCH 1/1 gpio: rockchip: Fix missing of_node_put() in rockchip_gpio_probe() and rockchip_gpiolib_register()
We should call of_node_put() for the reference returned by of_get_parent() which will increase the refcount.
--- drivers/gpio/gpio-rockchip.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpio/gpio-rockchip.c +2 -0
@@ -613,6 +613,7 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)return -ENODATA ; pctldev =of_pinctrl_get (pctlnp); +of_node_put (pctlnp);if (!pctldev)return -ENODEV ;
@@ -715,6 +716,7 @@ static int rockchip_gpio_probe(struct platform_device *pdev)return -ENODEV ; pctldev =of_pinctrl_get (pctlnp); +of_node_put (pctlnp);if (!pctldev)return -EPROBE_DEFER ;
Signature · 1 line
2.25.1
Quoted 3 lines · Liang He
We should call
of_node_put()for the reference returned byof_get_parent()which will increase the refcount.
Is it suggested by the so-called Hulk Robot? If so, it's not the first time I see that people don't think about, and just repeat as robots do. Have you read the code? Have you tried to understand what may happen when you put an OF node? What would be possible consequences to the rest of the code?
The above sentence is correct, implementation is not thought through. It might be a correct fix, but the commit message doesn't show that you really spent time on the change.
P.S> I would personally put all those Hulk Robot bla-bla-bla with lowest priority to consider, too many broken submissions...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 3 lines · Liang He
We should call
of_node_put()for the reference returned byof_get_parent()which will increase the refcount.Is it suggested by the so-called Hulk Robot? If so, it's not the first time I see that people don't think about, and just repeat as robots do. Have you read the code? Have you tried to understand what may happen when you put an OF node? What would be possible consequences to the rest of the code?
Quoted 10 lines
The above sentence is correct, implementation is not thought through. It might be a correct fix, but the commit message doesn't show that you really spent time on the change.
P.S> I would personally put all those Hulk Robot bla-bla-bla with lowest priority to consider, too many broken submissions...Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi, Andy,
Thanks very much for you to review my another patch code.
First of all, all of my commits are not from Hulk Robot and I am sorry that you have spent lots of time for those broken submissions.
Second, for this bug, while the of_get_parent() is only 3-4 lines above the adding of_node_put(), it is my fault to write so short commit log.
Thanks again,
Liang
Quoted 12 lines · Liang He
Quoted 11 lines · Andy Shevchenko
Quoted 3 lines · Liang He
We should call
of_node_put()for the reference returned byof_get_parent()which will increase the refcount.Is it suggested by the so-called Hulk Robot? If so, it's not the first time I see that people don't think about, and just repeat as robots do. Have you read the code? Have you tried to understand what may happen when you put an OF node? What would be possible consequences to the rest of the code?
Quoted 8 lines
Quoted 6 lines
The above sentence is correct, implementation is not thought through. It might be a correct fix, but the commit message doesn't show that you really spent time on the change.
P.S> I would personally put all those Hulk Robot bla-bla-bla with lowest priority to consider, too many broken submissions...Thanks very much for you to review my another patch code.
You're welcome!
Quoted 5 lines
First of all, all of my commits are not from Hulk Robot and I am sorry that you have spent lots of time for those broken submissions.
Second, for this bug, while the
of_get_parent()is only 3-4 lines above the addingof_node_put(), it is my fault to write so short commit log.
The problem is not in the length of the commit message, but in the semantics of it.
The *put() methods that drop reference counting are part of the garbage collector. If reference goes to 0 (or other defined threshold for that purpose) the resource may be very well gone. Now, you should check who and how is using that resource in the code. Depending on that the patch may be good in its current form, or should be completely rewritten.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 33 lines · Andy Shevchenko
Quoted 12 lines · Liang He
Quoted 11 lines · Andy Shevchenko
Quoted 3 lines · Liang He
We should call
of_node_put()for the reference returned byof_get_parent()which will increase the refcount.Is it suggested by the so-called Hulk Robot? If so, it's not the first time I see that people don't think about, and just repeat as robots do. Have you read the code? Have you tried to understand what may happen when you put an OF node? What would be possible consequences to the rest of the code?
Quoted 8 lines
Quoted 6 lines
The above sentence is correct, implementation is not thought through. It might be a correct fix, but the commit message doesn't show that you really spent time on the change.
P.S> I would personally put all those Hulk Robot bla-bla-bla with lowest priority to consider, too many broken submissions...Thanks very much for you to review my another patch code.
You're welcome!
Quoted 5 lines
First of all, all of my commits are not from Hulk Robot and I am sorry that you have spent lots of time for those broken submissions.
Second, for this bug, while the
of_get_parent()is only 3-4 lines above the addingof_node_put(), it is my fault to write so short commit log.The problem is not in the length of the commit message, but in the semantics of it.
Quoted 10 lines
The
*put()methods that drop reference counting are part of the garbage collector. If reference goes to 0 (or other defined threshold for that purpose) the resource may be very well gone. Now, you should check who and how is using that resource in the code. Depending on that the patch may be good in its current form, or should be completely rewritten.Signature · 2 lines
With Best Regards, Andy Shevchenko
Thanks, Andy,
For refcounting, please trust me, I have spent years on it.
But considering other parts of these kernel files and their relationship, i.e., "who and how is using that resource", your suggestion is right and professional.
I will treat these possible bugs more carefully and begin to consider if it is better to completely rewritten.
Thanks again,
Liang