Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions
@ 2024-09-19 17:15 Markus Elfring
  2024-09-19 17:50 ` Keller, Jacob E
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Markus Elfring @ 2024-09-19 17:15 UTC (permalink / raw)
  To: intel-wired-lan, netdev, David S. Miller, Eric Dumazet,
	Jacob Keller, Jakub Kicinski, Karol Kolacinski, Paolo Abeni,
	Przemek Kitszel, Richard Cochran, Tony Nguyen
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 19 Sep 2024 19:00:25 +0200

Add jump targets so that a bit of exception handling can be better reused
at the end of two function implementations.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 32 ++++++++++++------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index ef2e858f49bb..c445ae80094b 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -2813,10 +2813,8 @@ static int ice_ptp_rebuild_owner(struct ice_pf *pf)

 	/* Write the increment time value to PHY and LAN */
 	err = ice_ptp_write_incval(hw, ice_base_incval(pf));
-	if (err) {
-		ice_ptp_unlock(hw);
-		return err;
-	}
+	if (err)
+		goto err_unlock;

 	/* Write the initial Time value to PHY and LAN using the cached PHC
 	 * time before the reset and time difference between stopping and
@@ -2829,10 +2827,8 @@ static int ice_ptp_rebuild_owner(struct ice_pf *pf)
 		ts = ktime_to_timespec64(ktime_get_real());
 	}
 	err = ice_ptp_write_init(pf, &ts);
-	if (err) {
-		ice_ptp_unlock(hw);
-		return err;
-	}
+	if (err)
+		goto err_unlock;

 	/* Release the global hardware lock */
 	ice_ptp_unlock(hw);
@@ -2856,6 +2852,10 @@ static int ice_ptp_rebuild_owner(struct ice_pf *pf)
 	ice_ptp_enable_all_extts(pf);

 	return 0;
+
+err_unlock:
+	ice_ptp_unlock(hw);
+	return err;
 }

 /**
@@ -3129,18 +3129,14 @@ static int ice_ptp_init_owner(struct ice_pf *pf)

 	/* Write the increment time value to PHY and LAN */
 	err = ice_ptp_write_incval(hw, ice_base_incval(pf));
-	if (err) {
-		ice_ptp_unlock(hw);
-		goto err_exit;
-	}
+	if (err)
+		goto err_unlock;

 	ts = ktime_to_timespec64(ktime_get_real());
 	/* Write the initial Time value to PHY and LAN */
 	err = ice_ptp_write_init(pf, &ts);
-	if (err) {
-		ice_ptp_unlock(hw);
-		goto err_exit;
-	}
+	if (err)
+		goto err_unlock;

 	/* Release the global hardware lock */
 	ice_ptp_unlock(hw);
@@ -3168,6 +3164,10 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
 	pf->ptp.clock = NULL;
 err_exit:
 	return err;
+
+err_unlock:
+	ice_ptp_unlock(hw);
+	return err;
 }

 /**
--
2.46.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions
  2024-09-19 17:15 [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions Markus Elfring
@ 2024-09-19 17:50 ` Keller, Jacob E
  2024-09-20  6:34 ` Przemek Kitszel
  2024-10-04 10:52 ` [Intel-wired-lan] [PATCH] " Pucha, HimasekharX Reddy
  2 siblings, 0 replies; 6+ messages in thread
From: Keller, Jacob E @ 2024-09-19 17:50 UTC (permalink / raw)
  To: Markus Elfring, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Kolacinski, Karol, Paolo Abeni,
	Kitszel, Przemyslaw, Richard Cochran, Nguyen, Anthony L
  Cc: LKML



> -----Original Message-----
> From: Markus Elfring <Markus.Elfring@web.de>
> Sent: Thursday, September 19, 2024 10:15 AM
> To: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Keller, Jacob E
> <jacob.e.keller@intel.com>; Jakub Kicinski <kuba@kernel.org>; Kolacinski, Karol
> <karol.kolacinski@intel.com>; Paolo Abeni <pabeni@redhat.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Richard Cochran
> <richardcochran@gmail.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Cc: LKML <linux-kernel@vger.kernel.org>
> Subject: [PATCH] ice: Use common error handling code in two functions
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 19 Sep 2024 19:00:25 +0200
> 
> Add jump targets so that a bit of exception handling can be better reused
> at the end of two function implementations.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Seems fine.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions
  2024-09-19 17:15 [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions Markus Elfring
  2024-09-19 17:50 ` Keller, Jacob E
@ 2024-09-20  6:34 ` Przemek Kitszel
  2024-09-20  7:05   ` [Intel-wired-lan] " Markus Elfring
  2024-10-04 10:52 ` [Intel-wired-lan] [PATCH] " Pucha, HimasekharX Reddy
  2 siblings, 1 reply; 6+ messages in thread
From: Przemek Kitszel @ 2024-09-20  6:34 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Karol Kolacinski, Tony Nguyen, netdev, Richard Cochran, LKML,
	Eric Dumazet, intel-wired-lan, Jacob Keller, Jakub Kicinski,
	Paolo Abeni, David S. Miller

On 9/19/24 19:15, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 19 Sep 2024 19:00:25 +0200
> 
> Add jump targets so that a bit of exception handling can be better reused
> at the end of two function implementations.

Thank you for contribution, the change is fine, but not as a bugfix.
Please send as a [iwl-next], when the submission window opens.

> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>


> @@ -3168,6 +3164,10 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
>   	pf->ptp.clock = NULL;
>   err_exit:
>   	return err;
> +
> +err_unlock:
> +	ice_ptp_unlock(hw);
> +	return err;
>   }

You kept the current label naming scheme, that's good.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] ice: Use common error handling code in two functions
  2024-09-20  6:34 ` Przemek Kitszel
@ 2024-09-20  7:05   ` Markus Elfring
  2024-09-23 18:23     ` Tony Nguyen
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2024-09-20  7:05 UTC (permalink / raw)
  To: Przemek Kitszel, intel-wired-lan, netdev
  Cc: Richard Cochran, Karol Kolacinski, LKML, Eric Dumazet,
	Tony Nguyen, Jacob Keller, Jakub Kicinski, Paolo Abeni,
	David S. Miller

>> Add jump targets so that a bit of exception handling can be better reused
>> at the end of two function implementations.
>
> Thank you for contribution, the change is fine,

Thanks for this positive feedback.


>                                                 but not as a bugfix.

Would you like to qualify my update suggestion as a correction for
a coding style issue?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.11#n526


> Please send as a [iwl-next], when the submission window opens.

Will a patch resend really be needed for the proposed adjustment?

Regards,
Markus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] ice: Use common error handling code in two functions
  2024-09-20  7:05   ` [Intel-wired-lan] " Markus Elfring
@ 2024-09-23 18:23     ` Tony Nguyen
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2024-09-23 18:23 UTC (permalink / raw)
  To: Markus Elfring, Przemek Kitszel, intel-wired-lan, netdev
  Cc: Richard Cochran, Karol Kolacinski, LKML, Eric Dumazet,
	Jacob Keller, Jakub Kicinski, Paolo Abeni, David S. Miller



On 9/20/2024 12:05 AM, Markus Elfring wrote:
>>> Add jump targets so that a bit of exception handling can be better reused
>>> at the end of two function implementations.
>>
>> Thank you for contribution, the change is fine,
> 
> Thanks for this positive feedback.
> 
> 
>>                                                  but not as a bugfix.
> 
> Would you like to qualify my update suggestion as a correction for
> a coding style issue?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.11#n526

It can go to -next to correct the coding style, however, for -net it 
should be user visible bugs.

>> Please send as a [iwl-next], when the submission window opens.
> 
> Will a patch resend really be needed for the proposed adjustment?

I'll go ahead and apply this to iwl-next without a re-send, but please 
keep Przemek's comments in mind for future submissions.

Thanks,
Tony

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions
  2024-09-19 17:15 [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions Markus Elfring
  2024-09-19 17:50 ` Keller, Jacob E
  2024-09-20  6:34 ` Przemek Kitszel
@ 2024-10-04 10:52 ` Pucha, HimasekharX Reddy
  2 siblings, 0 replies; 6+ messages in thread
From: Pucha, HimasekharX Reddy @ 2024-10-04 10:52 UTC (permalink / raw)
  To: Markus Elfring, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, David S. Miller, Eric Dumazet,
	Keller, Jacob E, Jakub Kicinski, Kolacinski, Karol, Paolo Abeni,
	Kitszel, Przemyslaw, Richard Cochran, Nguyen, Anthony L
  Cc: LKML

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Markus Elfring
> Sent: Thursday, September 19, 2024 10:45 PM
> To: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Keller, Jacob E <jacob.e.keller@intel.com>; Jakub Kicinski <kuba@kernel.org>; Kolacinski, Karol <karol.kolacinski@intel.com>; Paolo Abeni <pabeni@redhat.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Richard Cochran <richardcochran@gmail.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Cc: LKML <linux-kernel@vger.kernel.org>
> Subject: [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 19 Sep 2024 19:00:25 +0200
>
> Add jump targets so that a bit of exception handling can be better reused at the end of two function implementations.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 32 ++++++++++++------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>

Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-04 10:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19 17:15 [Intel-wired-lan] [PATCH] ice: Use common error handling code in two functions Markus Elfring
2024-09-19 17:50 ` Keller, Jacob E
2024-09-20  6:34 ` Przemek Kitszel
2024-09-20  7:05   ` [Intel-wired-lan] " Markus Elfring
2024-09-23 18:23     ` Tony Nguyen
2024-10-04 10:52 ` [Intel-wired-lan] [PATCH] " Pucha, HimasekharX Reddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox