Skip to contentSkip to conversation

PCI: j721e: A couple of cleanups

PATCH Superseded Anand Moon 4 participants 20 messages Oct 14, 2025 – Oct 19, 2025

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Anand Moon

author
#0 lore raw

cover PCI: j721e: A couple of cleanups

Refactor the J721e probe function to use devres helpers for resource management. This replaces manual clock handling with devm_clk_get_optional_enabled() and assigns the reset GPIO directly to the struct members, eliminating unnecessary local variables.

These patches have been compile-tested only, as I do not have access to the hardware for runtime verification.

Changes
Add new patch for dev_err_probe return. dropped unsesary clk_disable_unprepare as its handle by devm_clk_get_optional_enabled.

RFC v1: https://lore.kernel.org/all/[email protected]/

Thanks
-Anand

Anand Moon (3):
PCI: j721e: Propagate dev_err_probe return value
PCI: j721e: Use devm_clk_get_optional_enabled() to get the clock
PCI: j721e: Use inline reset GPIO assignment and drop local variable

 drivers/pci/controller/cadence/pci-j721e.c | 39 ++++++++--------------
 1 file changed, 14 insertions(+), 25 deletions(-)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

Signature · 1 line
2.50.1
author
#1 lore raw

PATCH 1/3 PCI: j721e: Propagate dev_err_probe return value

Ensure that the return value from dev_err_probe() is consistently assigned back to ret in all error paths within j721e_pcie_probe(). This ensures the original error code are propagation for debugging.

Cc Siddharth Vadapalli <[email protected]>

---
v1: new patch in this series

---
 drivers/pci/controller/cadence/pci-j721e.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/cadence/pci-j721e.c +6 -6
index 5bc5ab20aa6d..9c7bfa77a66e 100644
@@ -569,20 +569,20 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
-		dev_err_probe(dev, ret, "pm_runtime_get_sync failed\n");
+		ret = dev_err_probe(dev, ret, "pm_runtime_get_sync failed\n");
 		goto err_get_sync;
 	}
 
 	ret = j721e_pcie_ctrl_init(pcie);
 	if (ret < 0) {
-		dev_err_probe(dev, ret, "j721e_pcie_ctrl_init failed\n");
+		ret = dev_err_probe(dev, ret, "j721e_pcie_ctrl_init failed\n");
 		goto err_get_sync;
 	}
 
 	ret = devm_request_irq(dev, irq, j721e_pcie_link_irq_handler, 0,
 			       "j721e-pcie-link-down-irq", pcie);
 	if (ret < 0) {
-		dev_err_probe(dev, ret, "failed to request link state IRQ %d\n", irq);
+		ret = dev_err_probe(dev, ret, "failed to request link state IRQ %d\n", irq);
 		goto err_get_sync;
 	}
 
@@ -599,7 +599,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 
 		ret = cdns_pcie_init_phy(dev, cdns_pcie);
 		if (ret) {
-			dev_err_probe(dev, ret, "Failed to init phy\n");
+			ret = dev_err_probe(dev, ret, "Failed to init phy\n");
 			goto err_get_sync;
 		}
 
@@ -611,7 +611,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 
 		ret = clk_prepare_enable(clk);
 		if (ret) {
-			dev_err_probe(dev, ret, "failed to enable pcie_refclk\n");
+			ret = dev_err_probe(dev, ret, "failed to enable pcie_refclk\n");
 			goto err_pcie_setup;
 		}
 		pcie->refclk = clk;
@@ -638,7 +638,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	case PCI_MODE_EP:
 		ret = cdns_pcie_init_phy(dev, cdns_pcie);
 		if (ret) {
-			dev_err_probe(dev, ret, "Failed to init phy\n");
+			ret = dev_err_probe(dev, ret, "Failed to init phy\n");
 			goto err_get_sync;
 		}
 
Signature · 1 line
2.50.1
author
#14 lore raw

PATCH 2/3 PCI: j721e: Use devm_clk_get_optional_enabled() to get the clock

In reply to Anand Moon

Use devm_clk_get_optional_enabled() helper instead of calling devm_clk_get_optional() and then clk_prepare_enable(). It simplifies the error handling and makes the code more compact. This changes removes the unnecessary clk variable and assigns the result of the devm_clk_get_optional_enabled() call directly to pcie->refclk. This makes the code more concise and readable without changing the behavior.

Cc Siddharth Vadapalli <[email protected]>

---
v1: Drop explicit clk_disable_unprepare — handled by devm_clk_get_optional_enabled
Since devm_clk_get_optional_enabled internally manages clk_prepare_enable and clk_disable_unprepare as part of its lifecycle, the explicit call to clk_disable_unprepare is redundant and can be safely removed.

---
 drivers/pci/controller/cadence/pci-j721e.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/pci/controller/cadence/pci-j721e.c +2 -12
index 9c7bfa77a66e..ed8e182f0772 100644
@@ -479,7 +479,6 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	struct cdns_pcie_ep *ep = NULL;
 	struct gpio_desc *gpiod;
 	void __iomem *base;
-	struct clk *clk;
 	u32 num_lanes;
 	u32 mode;
 	int ret;
@@ -603,18 +602,11 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 			goto err_get_sync;
 		}
 
-		clk = devm_clk_get_optional(dev, "pcie_refclk");
-		if (IS_ERR(clk)) {
-			ret = dev_err_probe(dev, PTR_ERR(clk), "failed to get pcie_refclk\n");
-			goto err_pcie_setup;
-		}
-
-		ret = clk_prepare_enable(clk);
-		if (ret) {
+		pcie->refclk = devm_clk_get_optional_enabled(dev, "pcie_refclk");
+		if (IS_ERR(pcie->refclk)) {
 			ret = dev_err_probe(dev, ret, "failed to enable pcie_refclk\n");
 			goto err_pcie_setup;
 		}
-		pcie->refclk = clk;
 
 		/*
 		 * Section 2.2 of the PCI Express Card Electromechanical
@@ -630,7 +622,6 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 
 		ret = cdns_pcie_host_setup(rc);
 		if (ret < 0) {
-			clk_disable_unprepare(pcie->refclk);
 			goto err_pcie_setup;
 		}
 
@@ -679,7 +670,6 @@ static void j721e_pcie_remove(struct platform_device *pdev)
 
 	gpiod_set_value_cansleep(pcie->reset_gpio, 0);
 
-	clk_disable_unprepare(pcie->refclk);
 	cdns_pcie_disable_phy(cdns_pcie);
 	j721e_pcie_disable_link_irq(pcie);
 	pm_runtime_put(dev);
Signature · 1 line
2.50.1
author
#18 lore raw

PATCH 3/3 PCI: j721e: Use inline reset GPIO assignment and drop local variable

In reply to Anand Moon

Change removes the unnecessary local gpiod variable and assigns the result of the devm_gpiod_get_optional() call directly to pcie->reset_gpio. This makes the code more concise and readable without changing the behavior.

---
v1: Add Rb - Siddharth

---
 drivers/pci/controller/cadence/pci-j721e.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/pci/controller/cadence/pci-j721e.c +6 -7
index ed8e182f0772..bd8fda0baba8 100644
@@ -477,7 +477,6 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	struct j721e_pcie *pcie;
 	struct cdns_pcie_rc *rc = NULL;
 	struct cdns_pcie_ep *ep = NULL;
-	struct gpio_desc *gpiod;
 	void __iomem *base;
 	u32 num_lanes;
 	u32 mode;
@@ -589,12 +588,12 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 
 	switch (mode) {
 	case PCI_MODE_RC:
-		gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
-		if (IS_ERR(gpiod)) {
-			ret = dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get reset GPIO\n");
+		pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+		if (IS_ERR(pcie->reset_gpio)) {
+			ret = dev_err_probe(dev, PTR_ERR(pcie->reset_gpio),
+					    "Failed to get reset GPIO\n");
 			goto err_get_sync;
 		}
-		pcie->reset_gpio = gpiod;
 
 		ret = cdns_pcie_init_phy(dev, cdns_pcie);
 		if (ret) {
@@ -615,9 +614,9 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 		 * This shall ensure that the power and the reference clock
 		 * are stable.
 		 */
-		if (gpiod) {
+		if (pcie->reset_gpio) {
 			msleep(PCIE_T_PVPERL_MS);
-			gpiod_set_value_cansleep(gpiod, 1);
+			gpiod_set_value_cansleep(pcie->reset_gpio, 1);
 		}
 
 		ret = cdns_pcie_host_setup(rc);
Signature · 1 line
2.50.1
#2 lore raw

Re: [PATCH 1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Anand Moon
Quoted 3 lines

Ensure that the return value from dev_err_probe() is consistently assigned back to ret in all error paths within j721e_pcie_probe(). This ensures the original error code are propagation for debugging.

I find the change description improvable.

I propose to take another source code transformation approach better into account.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075

Example:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/cadence/pci-j721e.c#L444-L636

	ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to init phy\n");
	if (ret)
		goto err_get_sync;

How do you think about to achieve such a source code variant also with the help of the semantic patch language (Coccinelle software)?

Regards,
Markus

author
#3 lore raw

Re: [PATCH 1/3] PCI: j721e: Propagate dev_err_probe return value

Hi Markus,

Thanks for the review comments.

Quoted 7 lines · Markus Elfring
Quoted 4 lines

Ensure that the return value from dev_err_probe() is consistently assigned back to ret in all error paths within j721e_pcie_probe(). This ensures the original error code are propagation for debugging.

I find the change description improvable.

Ok, I will update this once I get some more feedback on the changes.

Quoted 11 lines

I propose to take another source code transformation approach better into account.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075

Example:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/cadence/pci-j721e.c#L444-L636

        ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to init phy\n");
        if (ret)
                goto err_get_sync;

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 3 lines

How do you think about to achieve such a source code variant also with the help of the semantic patch language (Coccinelle software)?

I do not have any idea about this.

Quoted 3 lines

Regards,
Markus

Thanks
-Anand

#15 lore raw

Re: [PATCH 2/3] PCI: j721e: Use devm_clk_get_optional_enabled() to get the clock

In reply to Anand Moon
Quoted 3 lines

Use devm_clk_get_optional_enabled() helper instead of calling devm_clk_get_optional() and then clk_prepare_enable(). It simplifies the error handling and makes the code more compact. …

Can this information be sufficient so that the subsequent two sentences may be omitted from such a change description?

Regards,
Markus

#12 lore raw

Re: [PATCH v1 1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Anand Moon
Quoted 17 lines · Anand Moon

Ensure that the return value from dev_err_probe() is consistently assigned back to ret in all error paths within j721e_pcie_probe(). This ensures the original error code are propagation for debugging.

Cc Siddharth Vadapalli <[email protected]>

---
v1: new patch in this series

---
 drivers/pci/controller/cadence/pci-j721e.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/cadence/pci-j721e.c +0 -0
index 5bc5ab20aa6d..9c7bfa77a66e 100644

drivers/pci/controller/cadence/pci-j721e.c static int j721e_pcie_probe(struct platform_device *pdev) · line 573

Quoted 6 lines
drivers/pci/controller/cadence/pci-j721e.c +1 -1
@@ -569,20 +569,20 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
-		dev_err_probe(dev, ret, "pm_runtime_get_sync failed\n");
+		ret = dev_err_probe(dev, ret, "pm_runtime_get_sync failed\n");
 		goto err_get_sync;

Wait, no, this doesn't make sense. It's just assigning ret to itself. That's just confusing and pointless.

regards,
dan carpenter

#16 lore raw

Re: [PATCH v1 2/3] PCI: j721e: Use devm_clk_get_optional_enabled() to get the clock

In reply to Anand Moon
Quoted 36 lines · Anand Moon

Use devm_clk_get_optional_enabled() helper instead of calling devm_clk_get_optional() and then clk_prepare_enable(). It simplifies the error handling and makes the code more compact. This changes removes the unnecessary clk variable and assigns the result of the devm_clk_get_optional_enabled() call directly to pcie->refclk. This makes the code more concise and readable without changing the behavior.

Cc Siddharth Vadapalli <[email protected]>

---
v1: Drop explicit clk_disable_unprepare — handled by devm_clk_get_optional_enabled
Since devm_clk_get_optional_enabled internally manages clk_prepare_enable and clk_disable_unprepare as part of its lifecycle, the explicit call to clk_disable_unprepare is redundant and can be safely removed.

---
 drivers/pci/controller/cadence/pci-j721e.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/pci/controller/cadence/pci-j721e.c +0 -2
index 9c7bfa77a66e..ed8e182f0772 100644
@@ -479,7 +479,6 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 	struct cdns_pcie_ep *ep = NULL;
 	struct gpio_desc *gpiod;
 	void __iomem *base;
-	struct clk *clk;
 	u32 num_lanes;
 	u32 mode;
 	int ret;
@@ -603,18 +602,11 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 			goto err_get_sync;
 		}
 
-		clk = devm_clk_get_optional(dev, "pcie_refclk");

drivers/pci/controller/cadence/pci-j721e.c static int j721e_pcie_probe(struct platform_device *pdev) · line 607

Quoted 10 lines
drivers/pci/controller/cadence/pci-j721e.c +2 -7
-		if (IS_ERR(clk)) {
-			ret = dev_err_probe(dev, PTR_ERR(clk), "failed to get pcie_refclk\n");
-			goto err_pcie_setup;
-		}
-
-		ret = clk_prepare_enable(clk);
-		if (ret) {
+		pcie->refclk = devm_clk_get_optional_enabled(dev, "pcie_refclk");
+		if (IS_ERR(pcie->refclk)) {
 			ret = dev_err_probe(dev, ret, "failed to enable pcie_refclk\n");

This isn't correct. It's assigning ret to itself when it should be assigning PTR_ERR(pcie->refclk) to ret.

regards,
dan carpenter

#17 lore raw

Re: [PATCH v1 2/3] PCI: j721e: Use devm_clk_get_optional_enabled() to get the clock

In reply to Anand Moon

drivers/pci/controller/cadence/pci-j721e.c static int j721e_pcie_probe(struct platform_device *pdev) · line 626

Quoted 7 lines · Anand Moon
drivers/pci/controller/cadence/pci-j721e.c +0 -1
@@ -630,7 +622,6 @@ static int j721e_pcie_probe(struct platform_device *pdev)
 
 		ret = cdns_pcie_host_setup(rc);
 		if (ret < 0) {
-			clk_disable_unprepare(pcie->refclk);
 			goto err_pcie_setup;
 		}

This will introduce a checkpatch warning with checkpatch.pl -f because you need to delete the curly braces.

regards,
dan carpenter

#4 lore raw

Re: [PATCH 1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Anand Moon
Quoted 6 lines
Quoted 6 lines

I propose to take another source code transformation approach better into account.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075

Example:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/cadence/pci-j721e.c#L444-L636

Quoted 7 lines
Quoted 4 lines
        ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to init phy\n");
        if (ret)
                goto err_get_sync;

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. …

Where do you see undesirable technical differences?

Regards,
Markus

#10 lore raw

Re: [1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Anand Moon
Quoted 3 lines
Quoted 2 lines

How do you think about to achieve such a source code variant also with the help of the semantic patch language (Coccinelle software)?

I do not have any idea about this.

Can another source code search pattern (like the following) trigger further development considerations?

@display@
expression dev, e, x;
@@
if (e)
{
... when != e = x
* dev_err_probe(dev, e, ...);
...
}

Regards,
Markus

#19 lore raw

Re: [PATCH 3/3] PCI: j721e: Use inline reset GPIO assignment and drop local variable

In reply to Anand Moon
Quoted 4 lines

Change removes the unnecessary local gpiod variable and assigns the result of the devm_gpiod_get_optional() call directly to pcie->reset_gpio. This makes the code more concise and readable without changing the behavior.

Will another imperative wording approach become more helpful for an improved change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc1#n94

Regards,
Markus

author
#13 lore raw

Re: [PATCH v1 1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Dan Carpenter

Hi Dan

Quoted 14 lines · Dan Carpenter
Quoted 12 lines · Anand Moon

Ensure that the return value from dev_err_probe() is consistently assigned back to ret in all error paths within j721e_pcie_probe(). This ensures the original error code are propagation for debugging.

Cc Siddharth Vadapalli <[email protected]>

---
v1: new patch in this series

---
 drivers/pci/controller/cadence/pci-j721e.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Quoted 15 lines

drivers/pci/controller/cadence/pci-j721e.c static int j721e_pcie_probe(struct platform_device *pdev) · line 573

Quoted 11 lines
drivers/pci/controller/cadence/pci-j721e.c +1 -1
index 5bc5ab20aa6d..9c7bfa77a66e 100644
@@ -569,20 +569,20 @@ static int j721e_pcie_probe(struct platform_device *pdev)
      pm_runtime_enable(dev);
      ret = pm_runtime_get_sync(dev);
      if (ret < 0) {
-             dev_err_probe(dev, ret, "pm_runtime_get_sync failed\n");
+             ret = dev_err_probe(dev, ret, "pm_runtime_get_sync failed\n");
              goto err_get_sync;

Wait, no, this doesn't make sense. It's just assigning ret to itself. That's just confusing and pointless.

Ok, Thanks for clarifying.

Quoted 3 lines

regards,
dan carpenter

Thanks
-Anand

author
#5 lore raw

Re: [PATCH 1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Markus Elfring

Hi Markus, Vignesh,

Quoted 11 lines · Markus Elfring
Quoted 11 lines
Quoted 11 lines

I propose to take another source code transformation approach better into account.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075

Example:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/cadence/pci-j721e.c#L444-L636

        ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to init phy\n");
        if (ret)
                goto err_get_sync;
Quoted 5 lines
Quoted 3 lines

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. …

Where do you see undesirable technical differences?

The primary issue I wanted to confirm was the function execution order. since cdns_pcie_init_phy within dev_err_probe function

If other developers agree with the approach, I will modify this in a separate patch

As Dan Carpenter pointed out - " Wait, no, this doesn't make sense. It's just assigning ret to itself."

This patch seems irrelevant to me as the return value gets propagated to the error path.
Sorry for the noise. Let's drop these changes.

Since I don't have this hardware for testing, I will verify it on another available device.

Quoted 3 lines

Regards,
Markus

Thanks
-Anand

#6 lore raw

Re: [1/3] PCI: j721e: Propagate dev_err_probe return value

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

I propose to take another source code transformation approach better into account.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075

Example:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/cadence/pci-j721e.c#L444-L636

        ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to init phy\n");
        if (ret)
                goto err_get_sync;
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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. …

Where do you see undesirable technical differences?

The primary issue I wanted to confirm was the function execution order.

The desired control flow can be clarified in some ways.

Quoted 1 line

since cdns_pcie_init_phy within dev_err_probe function

One function should be executed before its return value will be directly passed to a subsequent function call, shouldn't it?

Quoted 2 lines

If other developers agree with the approach, I will modify this in a separate patch

There might be special coding style preferences involved (for a while).

Regards,
Markus

#7 lore raw

Re: [PATCH 1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Anand Moon

Le 19/10/2025 à 12:15, Anand Moon a écrit :

Quoted 18 lines

Hi Markus, Vignesh,

Quoted 15 lines · Markus Elfring
Quoted 14 lines
Quoted 11 lines

I propose to take another source code transformation approach better into account.
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/base/core.c#L5031-L5075

Example:
https://elixir.bootlin.com/linux/v6.17.1/source/drivers/pci/controller/cadence/pci-j721e.c#L444-L636

         ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to init phy\n");
         if (ret)
                 goto err_get_sync;

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. …

Quoted 7 lines
Quoted 1 line

Where do you see undesirable technical differences?

The primary issue I wanted to confirm was the function execution order. since cdns_pcie_init_phy within dev_err_probe function

If other developers agree with the approach, I will modify this in a separate patch

This other approach is just broken.

Using:
ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to
init phy\n");

1) is hard to read and understand.

2) would log an error message even if 0 is returned. This is just wrong.

2 good reasons not to do such things.

You should ignore people that are already ignored by most people on these lists.

CJ

Quoted 3 lines

As Dan Carpenter pointed out - " Wait, no, this doesn't make sense. It's just assigning ret to itself."

Yes, Dan is right.

Quoted 15 lines

This patch seems irrelevant to me as the return value gets propagated to the error path.
Sorry for the noise. Let's drop these changes.

Since I don't have this hardware for testing, I will verify it on another available device.

Quoted 3 lines

Regards,
Markus

Thanks
-Anand

#11 lore raw

Re: [1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Anand Moon
Quoted 3 lines
Quoted 2 lines

How do you think about to achieve such a source code variant also with the help of the semantic patch language (Coccinelle software)?

I do not have any idea about this.

Your software understanding evolved into another direction.

Can the following source code search pattern represent discussed development concerns in a succinct way?

@display@
expression dev, e;
@@
*e = dev_err_probe(dev, e, ...)

The evaluation of such a tiny SmPL script can point out that 14 source files of the software “Linux next-20251017” contain corresponding update candidates. Will any adjustments become helpful also at these places?

Regards,
Markus

#9 lore raw

Re: [1/3] PCI: j721e: Propagate dev_err_probe return value

In reply to Christophe JAILLET

…

Quoted 5 lines

Using:
ret = dev_err_probe(dev, cdns_pcie_init_phy(dev, cdns_pcie), "Failed to
init phy\n");

1) is hard to read and understand.

…

I would like to inform you that it can be determined with the help of another small SmPL script that variations of such assignment expressions are used in 108 source files of the software “Linux next-20251017”.
How will development imaginations evolve further then?

Regards,
Markus