diff mbox series

net: mv643xx_eth: Propagate errors from of_irq_to_resource()

Message ID 20211217003540.21344-1-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: mv643xx_eth: Propagate errors from of_irq_to_resource() | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Prabhakar Dec. 17, 2021, 12:35 a.m. UTC
The driver overrides the error code returned by of_irq_to_resource() to
-EINVAL. Switch to propagating the error code upstream so that errors
such as -EPROBE_DEFER are handled.

While at it drop the memset() operation as of_irq_to_resource()
does call memset() before filling in the IRQ resource.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Lad, Prabhakar Dec. 17, 2021, 12:47 a.m. UTC | #1
Hi All,

On Fri, Dec 17, 2021 at 12:35 AM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
>
> The driver overrides the error code returned by of_irq_to_resource() to
> -EINVAL. Switch to propagating the error code upstream so that errors
> such as -EPROBE_DEFER are handled.
>
> While at it drop the memset() operation as of_irq_to_resource()
> does call memset() before filling in the IRQ resource.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/net/ethernet/marvell/mv643xx_eth.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
Please ignore this patch, as the plan is to drop all the users
of_irq_to_resource() (see [0]). I'll send a new patch which uses the
preferred way of platform_get_irq().

[0] https://patchwork.ozlabs.org/project/linux-ide/patch/20211217001238.16298-1-prabhakar.mahadev-lad.rj@bp.renesas.com/

Cheers,
Prabhakar

> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index 105247582684..7a5ff629d158 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -2716,10 +2716,10 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
>         memset(&ppd, 0, sizeof(ppd));
>         ppd.shared = pdev;
>
> -       memset(&res, 0, sizeof(res));
> -       if (of_irq_to_resource(pnp, 0, &res) <= 0) {
> +       ret = of_irq_to_resource(pnp, 0, &res);
> +       if (ret <= 0) {
>                 dev_err(&pdev->dev, "missing interrupt on %pOFn\n", pnp);
> -               return -EINVAL;
> +               return ret ? ret : -ENXIO;
>         }
>
>         if (of_property_read_u32(pnp, "reg", &ppd.port_number)) {
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 105247582684..7a5ff629d158 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2716,10 +2716,10 @@  static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
 	memset(&ppd, 0, sizeof(ppd));
 	ppd.shared = pdev;
 
-	memset(&res, 0, sizeof(res));
-	if (of_irq_to_resource(pnp, 0, &res) <= 0) {
+	ret = of_irq_to_resource(pnp, 0, &res);
+	if (ret <= 0) {
 		dev_err(&pdev->dev, "missing interrupt on %pOFn\n", pnp);
-		return -EINVAL;
+		return ret ? ret : -ENXIO;
 	}
 
 	if (of_property_read_u32(pnp, "reg", &ppd.port_number)) {