PCI: rockchip: Propagate dev_err_probe return value
Subsystems (5)
PATCH 1/1 PCI: rockchip: Propagate dev_err_probe return value
Ensure that the return value from dev_err_probe() is consistently assigned back to return in all error paths within rockchip_pcie_init_port() function. This ensures the original error code are propagation for debugging.
--- drivers/pci/controller/pcie-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-rockchip.c +1 -1
@@ -134,7 +134,7 @@ int rockchip_pcie_init_port(struct rockchip_pcie *rockchip) err =reset_control_bulk_assert (ROCKCHIP_NUM_CORE_RSTS , rockchip->core_rsts);if (err) { -dev_err_probe (dev, err,"Couldn't assert Core resets\n" ); + err =dev_err_probe (dev, err,"Couldn't assert Core resets\n" ); goto err_exit_phy; }
base-commit: f406055cb18c6e299c4a783fc1effeb16be41803
Signature · 1 line
2.50.1
…
drivers/pci/controller/pcie-rockchip.c int rockchip_pcie_init_port(struct rockchip_pcie *rockchip) · line 139
Quoted 9 lines
+++
b/drivers/pci/controller/pcie-rockchip.cdrivers/pci/controller/pcie-rockchip.c +1
-1@@ -134,7 +134,7 @@ int rockchip_pcie_init_port(struct rockchip_pcie *rockchip) err =reset_control_bulk_assert (ROCKCHIP_NUM_CORE_RSTS , rockchip->core_rsts);if (err) { -dev_err_probe (dev, err,"Couldn't assert Core resets\n" ); + err =dev_err_probe (dev, err,"Couldn't assert Core resets\n" ); goto err_exit_phy; }
I find such a variable reassignment not helpful here. Do you really miss an error code propagation?
Regards,
Markus
Quoted 4 lines
Ensure that the return value from
dev_err_probe()is consistently assigned back to return in all error paths withinrockchip_pcie_init_port()function. This ensures the original error code are propagation for debugging.
I find the change description improvable.
Would an other source code variant become more desirable?
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075
err = dev_err_probe(dev, reset_control_bulk_assert(ROCKCHIP_NUM_CORE_RSTS, rockchip->core_rsts), "Couldn't assert Core resets\n"); if (err) goto err_exit_phy;
Regards,
Markus
Hi Markus,
Quoted 8 lines · Markus Elfring
Quoted 5 lines
Ensure that the return value from
dev_err_probe()is consistently assigned back to return in all error paths withinrockchip_pcie_init_port()function. This ensures the original error code are propagation for debugging.I find the change description improvable.
Ok, is this ok?
When using the dev_err_probe() helper function in rockchip_pcie_init_port(), ensure its return value is consistently assigned to the return variable. This guarantees that the original error code, whether it's a specific error or -EPROBE_DEFER,
is correctly propagated up the call stack for proper error handling and debugging.
Quoted 9 lines
Would an other source code variant become more desirable?
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075err = dev_err_probe(dev, reset_control_bulk_assert(ROCKCHIP_NUM_CORE_RSTS, rockchip->core_rsts), "Couldn't assert Core resets\n"); if (err) goto err_exit_phy;
No, the correct code ensures that dev_err_probe() is only called when an actual error has
occurred, providing a clear and accurate log entry. For deferred probe (-EPROBE_DEFER),
it will correctly log at a debug level, as intended for that scenario. For other errors, it will provide
a standard error message.
Quoted 4 lines
Regards,
Markus
Thanks
-Anand
Quoted 3 lines
Quoted 2 lines
I find the change description improvable.
Ok, is this ok?
I present other wording preferences.
Quoted 2 lines
When using the
dev_err_probe()helper function inrockchip_pcie_init_port(), ensure its return value is consistently assigned to the return variable.
I hope that we can achieve consensus on the corresponding source code places.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/pcie-rockchip.c#L115-L202
Quoted 4 lines
This guarantees that the original error code, whether it's a specific error or -EPROBE_DEFER,
is correctly propagated up the call stack for proper error handling and debugging.
The mentioned programming interface should be applied correctly.
Quoted 11 lines
Quoted 8 lines
Would an other source code variant become more desirable?
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075err = dev_err_probe(dev, reset_control_bulk_assert(ROCKCHIP_NUM_CORE_RSTS, rockchip->core_rsts), "Couldn't assert Core resets\n"); if (err) goto err_exit_phy;No, the correct code ensures that
dev_err_probe()is only called when an actual error has
occurred, providing a clear and accurate log entry. …
Do you think that anything different would happen according to my transformation suggestion?
Regards,
Markus
Manivannan Sadhasivam
maintainerQuoted 15 lines · Anand Moon
Ensure that the return value from
dev_err_probe()is consistently assigned back to return in all error paths withinrockchip_pcie_init_port()function. This ensures the original error code are propagation for debugging.Signed-off-by Anand Moon <[email protected]>--- drivers/pci/controller/pcie-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/controller/pcie-rockchip.c +0
-0
drivers/pci/controller/pcie-rockchip.c int rockchip_pcie_init_port(struct rockchip_pcie *rockchip) · line 137
Quoted 5 lines
drivers/pci/controller/pcie-rockchip.c +1
-1@@ -134,7 +134,7 @@ int rockchip_pcie_init_port(struct rockchip_pcie *rockchip) err =reset_control_bulk_assert (ROCKCHIP_NUM_CORE_RSTS , rockchip->core_rsts);if (err) { -dev_err_probe (dev, err,"Couldn't assert Core resets\n" ); + err =dev_err_probe (dev, err,"Couldn't assert Core resets\n" );
This change is pointless. Is the 'err' value going to change with the reassignment? NO. Then what this change is about?
Please do not send cleanup patches that does nothing useful.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்