diff mbox series

[v2] net: bcmasp: Use common error handling code in bcmasp_probe()

Message ID 38279cb8-ff60-427e-ae9f-5f973955ffa6@web.de (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: bcmasp: Use common error handling code in bcmasp_probe() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1134 this patch: 1134
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 1161 this patch: 1161
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1161 this patch: 1161
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Markus Elfring Nov. 15, 2023, 9:10 a.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 15 Nov 2023 09:38:56 +0100

Add a jump target so that a bit of exception handling can be better reused
in this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
Special expectations were expressed for the previous patch size.

* Jakub Kicinski
  https://lore.kernel.org/netdev/20231106145806.669875f4@kernel.org/

* Justin Chen
  https://lore.kernel.org/netdev/CALSSxFYRgPwEq+QhCOYPqrtae8RvL=jTOcz4mk3vbe+Fc0QwbQ@mail.gmail.com/

* Florian Fainelli
  https://lore.kernel.org/netdev/4053e838-e5cf-4450-8067-21bdec989d1b@broadcom.com/


Thus another change variant can eventually be integrated.


 drivers/net/ethernet/broadcom/asp2/bcmasp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.42.1

Comments

Justin Chen Nov. 16, 2023, 7:05 p.m. UTC | #1
On Wed, Nov 15, 2023 at 1:11 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 15 Nov 2023 09:38:56 +0100
>
> Add a jump target so that a bit of exception handling can be better reused
> in this function implementation.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>
> v2:
> Special expectations were expressed for the previous patch size.
>
> * Jakub Kicinski
>   https://lore.kernel.org/netdev/20231106145806.669875f4@kernel.org/
>
> * Justin Chen
>   https://lore.kernel.org/netdev/CALSSxFYRgPwEq+QhCOYPqrtae8RvL=jTOcz4mk3vbe+Fc0QwbQ@mail.gmail.com/
>
> * Florian Fainelli
>   https://lore.kernel.org/netdev/4053e838-e5cf-4450-8067-21bdec989d1b@broadcom.com/
>
>
> Thus another change variant can eventually be integrated.
>
>
>  drivers/net/ethernet/broadcom/asp2/bcmasp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> index 29b04a274d07..7d6c15732d9f 100644
> --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> @@ -1304,9 +1304,8 @@ static int bcmasp_probe(struct platform_device *pdev)
>                 intf = bcmasp_interface_create(priv, intf_node, i);
>                 if (!intf) {
>                         dev_err(dev, "Cannot create eth interface %d\n", i);
> -                       bcmasp_remove_intfs(priv);
>                         of_node_put(intf_node);
> -                       goto of_put_exit;
> +                       goto remove_intfs;
>                 }
>                 list_add_tail(&intf->list, &priv->intfs);
>                 i++;
> @@ -1331,6 +1330,7 @@ static int bcmasp_probe(struct platform_device *pdev)
>                         netdev_err(intf->ndev,
>                                    "failed to register net_device: %d\n", ret);
>                         priv->destroy_wol(priv);
> +remove_intfs:
>                         bcmasp_remove_intfs(priv);
>                         goto of_put_exit;
>                 }
> --
> 2.42.1
>
nak. Doesn't save any lines of code. Doesn't make things clearer or
easier to follow. This doesn't seem like an improvement to me.

Justin
Markus Elfring Nov. 16, 2023, 8:24 p.m. UTC | #2
>> Add a jump target so that a bit of exception handling can be better reused
>> in this function implementation.>> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
>> @@ -1304,9 +1304,8 @@ static int bcmasp_probe(struct platform_device *pdev)
>>                 intf = bcmasp_interface_create(priv, intf_node, i);
>>                 if (!intf) {
>>                         dev_err(dev, "Cannot create eth interface %d\n", i);
>> -                       bcmasp_remove_intfs(priv);
>>                         of_node_put(intf_node);
>> -                       goto of_put_exit;
>> +                       goto remove_intfs;
>>                 }
>>                 list_add_tail(&intf->list, &priv->intfs);
>>                 i++;
>> @@ -1331,6 +1330,7 @@ static int bcmasp_probe(struct platform_device *pdev)
>>                         netdev_err(intf->ndev,
>>                                    "failed to register net_device: %d\n", ret);
>>                         priv->destroy_wol(priv);
>> +remove_intfs:
>>                         bcmasp_remove_intfs(priv);
>>                         goto of_put_exit;
>>                 }
>> --
>> 2.42.1
>>
> nak. Doesn't save any lines of code.

Would you get into the mood to take also another look at consequences for executable code?


> Doesn't make things clearer or easier to follow.

Maybe.


> This doesn't seem like an improvement to me.

Can this software implementation benefit from one function call less?

Regards,
Markus
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 29b04a274d07..7d6c15732d9f 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1304,9 +1304,8 @@  static int bcmasp_probe(struct platform_device *pdev)
 		intf = bcmasp_interface_create(priv, intf_node, i);
 		if (!intf) {
 			dev_err(dev, "Cannot create eth interface %d\n", i);
-			bcmasp_remove_intfs(priv);
 			of_node_put(intf_node);
-			goto of_put_exit;
+			goto remove_intfs;
 		}
 		list_add_tail(&intf->list, &priv->intfs);
 		i++;
@@ -1331,6 +1330,7 @@  static int bcmasp_probe(struct platform_device *pdev)
 			netdev_err(intf->ndev,
 				   "failed to register net_device: %d\n", ret);
 			priv->destroy_wol(priv);
+remove_intfs:
 			bcmasp_remove_intfs(priv);
 			goto of_put_exit;
 		}