@@ -159,7 +159,7 @@ struct cy8c95x0_pinctrl {
159159 DECLARE_BITMAP (irq_trig_high , MAX_LINE );
160160 DECLARE_BITMAP (push_pull , MAX_LINE );
161161 DECLARE_BITMAP (shiftmask , MAX_LINE );
162- int nport ;
162+ unsigned int nport ;
163163 struct gpio_chip gpio_chip ;
164164 unsigned long driver_data ;
165165 struct device * dev ;
@@ -610,9 +610,8 @@ static int cy8c95x0_write_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
610610 DECLARE_BITMAP (tmask , MAX_LINE );
611611 DECLARE_BITMAP (tval , MAX_LINE );
612612 int write_val ;
613- int ret = 0 ;
614- int i ;
615613 u8 bits ;
614+ int ret ;
616615
617616 /* Add the 4 bit gap of Gport2 */
618617 bitmap_andnot (tmask , mask , chip -> shiftmask , MAX_LINE );
@@ -623,7 +622,7 @@ static int cy8c95x0_write_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
623622 bitmap_shift_left (tval , tval , 4 , MAX_LINE );
624623 bitmap_replace (tval , tval , val , chip -> shiftmask , BANK_SZ * 3 );
625624
626- for (i = 0 ; i < chip -> nport ; i ++ ) {
625+ for (unsigned int i = 0 ; i < chip -> nport ; i ++ ) {
627626 /* Skip over unused banks */
628627 bits = bitmap_get_value8 (tmask , i * BANK_SZ );
629628 if (!bits )
@@ -632,15 +631,13 @@ static int cy8c95x0_write_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
632631 write_val = bitmap_get_value8 (tval , i * BANK_SZ );
633632
634633 ret = cy8c95x0_regmap_update_bits (chip , reg , i , bits , write_val );
635- if (ret < 0 )
636- goto out ;
634+ if (ret < 0 ) {
635+ dev_err (chip -> dev , "failed writing register %d, port %u: err %d\n" , reg , i , ret );
636+ return ret ;
637+ }
637638 }
638- out :
639-
640- if (ret < 0 )
641- dev_err (chip -> dev , "failed writing register %d, port %d: err %d\n" , reg , i , ret );
642639
643- return ret ;
640+ return 0 ;
644641}
645642
646643static int cy8c95x0_read_regs_mask (struct cy8c95x0_pinctrl * chip , int reg ,
@@ -650,9 +647,8 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
650647 DECLARE_BITMAP (tval , MAX_LINE );
651648 DECLARE_BITMAP (tmp , MAX_LINE );
652649 int read_val ;
653- int ret = 0 ;
654- int i ;
655650 u8 bits ;
651+ int ret ;
656652
657653 /* Add the 4 bit gap of Gport2 */
658654 bitmap_andnot (tmask , mask , chip -> shiftmask , MAX_LINE );
@@ -663,15 +659,17 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
663659 bitmap_shift_left (tval , tval , 4 , MAX_LINE );
664660 bitmap_replace (tval , tval , val , chip -> shiftmask , BANK_SZ * 3 );
665661
666- for (i = 0 ; i < chip -> nport ; i ++ ) {
662+ for (unsigned int i = 0 ; i < chip -> nport ; i ++ ) {
667663 /* Skip over unused banks */
668664 bits = bitmap_get_value8 (tmask , i * BANK_SZ );
669665 if (!bits )
670666 continue ;
671667
672668 ret = cy8c95x0_regmap_read (chip , reg , i , & read_val );
673- if (ret < 0 )
674- goto out ;
669+ if (ret < 0 ) {
670+ dev_err (chip -> dev , "failed reading register %d, port %u: err %d\n" , reg , i , ret );
671+ return ret ;
672+ }
675673
676674 read_val &= bits ;
677675 read_val |= bitmap_get_value8 (tval , i * BANK_SZ ) & ~bits ;
@@ -682,11 +680,7 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
682680 bitmap_shift_right (tmp , tval , 4 , MAX_LINE );
683681 bitmap_replace (val , tmp , tval , chip -> shiftmask , MAX_LINE );
684682
685- out :
686- if (ret < 0 )
687- dev_err (chip -> dev , "failed reading register %d, port %d: err %d\n" , reg , i , ret );
688-
689- return ret ;
683+ return 0 ;
690684}
691685
692686static int cy8c95x0_gpio_direction_input (struct gpio_chip * gc , unsigned int off )
0 commit comments