* [Intel-wired-lan] [PATCH net] ice: use int for n_per_out loop
@ 2022-11-02 23:59 Jacob Keller
2022-11-04 16:08 ` G, GurucharanX
0 siblings, 1 reply; 2+ messages in thread
From: Jacob Keller @ 2022-11-02 23:59 UTC (permalink / raw)
To: Intel Wired LAN
In ice_ptp_enable_all_clkout and ice_ptp_disable_all_clkout we use a uint
for a for loop iterating over the n_per_out value from the struct
ptp_clock_info. The struct member is a signed int, and the use of uint
generates a -Wsign-compare warning:
drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_ptp_enable_all_clkout’:
drivers/net/ethernet/intel/ice/ice_ptp.c:1710:23: error: comparison of integer expressions of different signedness: ‘uint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
1710 | for (i = 0; i < pf->ptp.info.n_per_out; i++)
| ^
cc1: all warnings being treated as errors
While we don't generally compile with -Wsign-compare, its still a good idea
not to mix types. Fix the two functions to use a plain signed integer.
Fixes: 9ee313433c48 ("ice: restart periodic outputs around time changes")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ptp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 011b727ab190..be147fb641ae 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -1688,7 +1688,7 @@ static int ice_ptp_cfg_clkout(struct ice_pf *pf, unsigned int chan,
*/
static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
{
- uint i;
+ int i;
for (i = 0; i < pf->ptp.info.n_per_out; i++)
if (pf->ptp.perout_channels[i].ena)
@@ -1705,7 +1705,7 @@ static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
*/
static void ice_ptp_enable_all_clkout(struct ice_pf *pf)
{
- uint i;
+ int i;
for (i = 0; i < pf->ptp.info.n_per_out; i++)
if (pf->ptp.perout_channels[i].ena)
base-commit: c70e8985365ba84d8d668a27a45c21d1fc26f818
--
2.38.0.83.gd420dda05763
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Intel-wired-lan] [PATCH net] ice: use int for n_per_out loop
2022-11-02 23:59 [Intel-wired-lan] [PATCH net] ice: use int for n_per_out loop Jacob Keller
@ 2022-11-04 16:08 ` G, GurucharanX
0 siblings, 0 replies; 2+ messages in thread
From: G, GurucharanX @ 2022-11-04 16:08 UTC (permalink / raw)
To: Keller, Jacob E, Intel Wired LAN
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Jacob Keller
> Sent: Thursday, November 3, 2022 5:30 AM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PATCH net] ice: use int for n_per_out loop
>
> In ice_ptp_enable_all_clkout and ice_ptp_disable_all_clkout we use a uint
> for a for loop iterating over the n_per_out value from the struct
> ptp_clock_info. The struct member is a signed int, and the use of uint
> generates a -Wsign-compare warning:
>
> drivers/net/ethernet/intel/ice/ice_ptp.c: In function
> ‘ice_ptp_enable_all_clkout’:
> drivers/net/ethernet/intel/ice/ice_ptp.c:1710:23: error: comparison of
> integer expressions of different signedness: ‘uint’ {aka ‘unsigned int’} and
> ‘int’ [-Werror=sign-compare]
> 1710 | for (i = 0; i < pf->ptp.info.n_per_out; i++)
> | ^
> cc1: all warnings being treated as errors
>
> While we don't generally compile with -Wsign-compare, its still a good idea
> not to mix types. Fix the two functions to use a plain signed integer.
>
> Fixes: 9ee313433c48 ("ice: restart periodic outputs around time changes")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_ptp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-04 16:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-02 23:59 [Intel-wired-lan] [PATCH net] ice: use int for n_per_out loop Jacob Keller
2022-11-04 16:08 ` G, GurucharanX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox