mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
ice: Use common error handling code in two functions
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> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
8d873ccd8a
commit
5f4493f06e
|
|
@ -2857,10 +2857,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
|
||||
|
|
@ -2873,10 +2871,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);
|
||||
|
|
@ -2900,6 +2896,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3032,18 +3032,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);
|
||||
|
|
@ -3063,6 +3059,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user