diff mbox series

[v5,-next,09/11] PCI: brcmstb: Fix for missing of_node_put

Message ID 20250120130119.671119-10-svarbanov@suse.de (mailing list archive)
State New, archived
Headers show
Series Add PCIe support for bcm2712 | expand

Commit Message

Stanimir Varbanov Jan. 20, 2025, 1:01 p.m. UTC
A call to of_parse_phandle() increments refcount, of_node_put must be
called when done the work on it. Fix missing of_node_put() on the
msi_np device node by using scope based of_node_put() cleanups.

Cc: stable@vger.kernel.org # v5.10+
Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
---
v4 -> v5:
 - New patch in the series.

 drivers/pci/controller/pcie-brcmstb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Florian Fainelli Jan. 21, 2025, 6:32 p.m. UTC | #1
On 1/20/25 05:01, Stanimir Varbanov wrote:
> A call to of_parse_phandle() increments refcount, of_node_put must be
> called when done the work on it. Fix missing of_node_put() on the
> msi_np device node by using scope based of_node_put() cleanups.
> 
> Cc: stable@vger.kernel.org # v5.10+
> Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
> ---
> v4 -> v5:
>   - New patch in the series.
> 
>   drivers/pci/controller/pcie-brcmstb.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 744fe1a4cf9c..546056f7f0d3 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -1844,7 +1844,8 @@ static struct pci_ops brcm7425_pcie_ops = {
>   
>   static int brcm_pcie_probe(struct platform_device *pdev)
>   {
> -	struct device_node *np = pdev->dev.of_node, *msi_np;
> +	struct device_node *msi_np __free(device_node) = NULL;

In the interest of making this a straight back port to 5.10 that does 
not have all of the __free() goodies, I would just add the missing 
of_node_put() where necessary.

Also, since this is a bug fix, you should probably make it appear 
earlier in the patch series, or even sent it as a separate fix entirely.
Stanimir Varbanov Jan. 22, 2025, 4:20 p.m. UTC | #2
Hi Florian,

On 1/21/25 8:32 PM, Florian Fainelli wrote:
> On 1/20/25 05:01, Stanimir Varbanov wrote:
>> A call to of_parse_phandle() increments refcount, of_node_put must be
>> called when done the work on it. Fix missing of_node_put() on the
>> msi_np device node by using scope based of_node_put() cleanups.
>>
>> Cc: stable@vger.kernel.org # v5.10+
>> Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
>> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
>> ---
>> v4 -> v5:
>>   - New patch in the series.
>>
>>   drivers/pci/controller/pcie-brcmstb.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/
>> controller/pcie-brcmstb.c
>> index 744fe1a4cf9c..546056f7f0d3 100644
>> --- a/drivers/pci/controller/pcie-brcmstb.c
>> +++ b/drivers/pci/controller/pcie-brcmstb.c
>> @@ -1844,7 +1844,8 @@ static struct pci_ops brcm7425_pcie_ops = {
>>     static int brcm_pcie_probe(struct platform_device *pdev)
>>   {
>> -    struct device_node *np = pdev->dev.of_node, *msi_np;
>> +    struct device_node *msi_np __free(device_node) = NULL;
> 
> In the interest of making this a straight back port to 5.10 that does
> not have all of the __free() goodies, I would just add the missing
> of_node_put() where necessary.

Good point. Thank you.

> 
> Also, since this is a bug fix, you should probably make it appear
> earlier in the patch series, or even sent it as a separate fix entirely.

OK, will send it as a standalone patch (as v2 with your comment addressed).

~Stan
Stanimir Varbanov Jan. 27, 2025, 4:04 p.m. UTC | #3
Hi,

On 1/22/25 6:20 PM, Stanimir Varbanov wrote:
> Hi Florian,
> 
> On 1/21/25 8:32 PM, Florian Fainelli wrote:
>> On 1/20/25 05:01, Stanimir Varbanov wrote:
>>> A call to of_parse_phandle() increments refcount, of_node_put must be
>>> called when done the work on it. Fix missing of_node_put() on the
>>> msi_np device node by using scope based of_node_put() cleanups.
>>>
>>> Cc: stable@vger.kernel.org # v5.10+
>>> Fixes: 40ca1bf580ef ("PCI: brcmstb: Add MSI support")
>>> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
>>> ---
>>> v4 -> v5:
>>>   - New patch in the series.
>>>
>>>   drivers/pci/controller/pcie-brcmstb.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/
>>> controller/pcie-brcmstb.c
>>> index 744fe1a4cf9c..546056f7f0d3 100644
>>> --- a/drivers/pci/controller/pcie-brcmstb.c
>>> +++ b/drivers/pci/controller/pcie-brcmstb.c
>>> @@ -1844,7 +1844,8 @@ static struct pci_ops brcm7425_pcie_ops = {
>>>     static int brcm_pcie_probe(struct platform_device *pdev)
>>>   {
>>> -    struct device_node *np = pdev->dev.of_node, *msi_np;
>>> +    struct device_node *msi_np __free(device_node) = NULL;
>>
>> In the interest of making this a straight back port to 5.10 that does
>> not have all of the __free() goodies, I would just add the missing
>> of_node_put() where necessary.
> 
> Good point. Thank you.
> 
>>
>> Also, since this is a bug fix, you should probably make it appear
>> earlier in the patch series, or even sent it as a separate fix entirely.
> 
> OK, will send it as a standalone patch (as v2 with your comment addressed).

Sent here [1], now separate from this series.

~Stan

[1]
https://lore.kernel.org/lkml/20250122222955.1752778-1-svarbanov@suse.de/T/
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 744fe1a4cf9c..546056f7f0d3 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1844,7 +1844,8 @@  static struct pci_ops brcm7425_pcie_ops = {
 
 static int brcm_pcie_probe(struct platform_device *pdev)
 {
-	struct device_node *np = pdev->dev.of_node, *msi_np;
+	struct device_node *msi_np __free(device_node) = NULL;
+	struct device_node *np = pdev->dev.of_node;
 	struct pci_host_bridge *bridge;
 	const struct pcie_cfg_data *data;
 	struct brcm_pcie *pcie;