static int rswitch_ether_port_init_all(struct rswitch_private *priv)
 {
-       int i, err;
+       unsigned int i;
+       int err;
 
        rswitch_for_each_enabled_port(priv, i) {
                err = rswitch_ether_port_init_one(priv->rdev[i]);
 
 static int rswitch_init(struct rswitch_private *priv)
 {
-       int i, err;
+       unsigned int i;
+       int err;
 
        for (i = 0; i < RSWITCH_NUM_PORTS; i++)
                rswitch_etha_init(priv, i);
        for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
                err = rswitch_device_alloc(priv, i);
                if (err < 0) {
-                       for (i--; i >= 0; i--)
+                       for (; i-- > 0; )
                                rswitch_device_free(priv, i);
                        goto err_device_alloc;
                }
 
 static void rswitch_deinit(struct rswitch_private *priv)
 {
-       int i;
+       unsigned int i;
 
        rswitch_gwca_hw_deinit(priv);
        rcar_gen4_ptp_unregister(priv->ptp_priv);