@@ -823,7 +823,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
823
823
ret = pci_read_config_byte (chip -> pdev ,
824
824
O2_SD_LOCK_WP , & scratch );
825
825
if (ret )
826
- return ret ;
826
+ goto read_fail ;
827
827
scratch &= 0x7f ;
828
828
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
829
829
@@ -834,7 +834,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
834
834
ret = pci_read_config_byte (chip -> pdev ,
835
835
O2_SD_CLKREQ , & scratch );
836
836
if (ret )
837
- return ret ;
837
+ goto read_fail ;
838
838
scratch |= 0x20 ;
839
839
pci_write_config_byte (chip -> pdev , O2_SD_CLKREQ , scratch );
840
840
@@ -843,7 +843,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
843
843
*/
844
844
ret = pci_read_config_byte (chip -> pdev , O2_SD_CAPS , & scratch );
845
845
if (ret )
846
- return ret ;
846
+ goto read_fail ;
847
847
scratch |= 0x01 ;
848
848
pci_write_config_byte (chip -> pdev , O2_SD_CAPS , scratch );
849
849
pci_write_config_byte (chip -> pdev , O2_SD_CAPS , 0x73 );
@@ -856,15 +856,15 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
856
856
ret = pci_read_config_byte (chip -> pdev ,
857
857
O2_SD_INF_MOD , & scratch );
858
858
if (ret )
859
- return ret ;
859
+ goto read_fail ;
860
860
scratch |= 0x08 ;
861
861
pci_write_config_byte (chip -> pdev , O2_SD_INF_MOD , scratch );
862
862
863
863
/* Lock WP */
864
864
ret = pci_read_config_byte (chip -> pdev ,
865
865
O2_SD_LOCK_WP , & scratch );
866
866
if (ret )
867
- return ret ;
867
+ goto read_fail ;
868
868
scratch |= 0x80 ;
869
869
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
870
870
break ;
@@ -875,7 +875,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
875
875
ret = pci_read_config_byte (chip -> pdev ,
876
876
O2_SD_LOCK_WP , & scratch );
877
877
if (ret )
878
- return ret ;
878
+ goto read_fail ;
879
879
880
880
scratch &= 0x7f ;
881
881
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
@@ -886,7 +886,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
886
886
O2_SD_FUNC_REG0 ,
887
887
& scratch_32 );
888
888
if (ret )
889
- return ret ;
889
+ goto read_fail ;
890
890
scratch_32 = ((scratch_32 & 0xFF000000 ) >> 24 );
891
891
892
892
/* Check Whether subId is 0x11 or 0x12 */
@@ -898,7 +898,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
898
898
O2_SD_FUNC_REG4 ,
899
899
& scratch_32 );
900
900
if (ret )
901
- return ret ;
901
+ goto read_fail ;
902
902
903
903
/* Enable Base Clk setting change */
904
904
scratch_32 |= O2_SD_FREG4_ENABLE_CLK_SET ;
@@ -921,7 +921,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
921
921
ret = pci_read_config_dword (chip -> pdev ,
922
922
O2_SD_CLK_SETTING , & scratch_32 );
923
923
if (ret )
924
- return ret ;
924
+ goto read_fail ;
925
925
926
926
scratch_32 &= ~(0xFF00 );
927
927
scratch_32 |= 0x07E0C800 ;
@@ -931,14 +931,14 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
931
931
ret = pci_read_config_dword (chip -> pdev ,
932
932
O2_SD_CLKREQ , & scratch_32 );
933
933
if (ret )
934
- return ret ;
934
+ goto read_fail ;
935
935
scratch_32 |= 0x3 ;
936
936
pci_write_config_dword (chip -> pdev , O2_SD_CLKREQ , scratch_32 );
937
937
938
938
ret = pci_read_config_dword (chip -> pdev ,
939
939
O2_SD_PLL_SETTING , & scratch_32 );
940
940
if (ret )
941
- return ret ;
941
+ goto read_fail ;
942
942
943
943
scratch_32 &= ~(0x1F3F070E );
944
944
scratch_32 |= 0x18270106 ;
@@ -949,7 +949,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
949
949
ret = pci_read_config_dword (chip -> pdev ,
950
950
O2_SD_CAP_REG2 , & scratch_32 );
951
951
if (ret )
952
- return ret ;
952
+ goto read_fail ;
953
953
scratch_32 &= ~(0xE0 );
954
954
pci_write_config_dword (chip -> pdev ,
955
955
O2_SD_CAP_REG2 , scratch_32 );
@@ -961,7 +961,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
961
961
ret = pci_read_config_byte (chip -> pdev ,
962
962
O2_SD_LOCK_WP , & scratch );
963
963
if (ret )
964
- return ret ;
964
+ goto read_fail ;
965
965
scratch |= 0x80 ;
966
966
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
967
967
break ;
@@ -971,15 +971,15 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
971
971
ret = pci_read_config_byte (chip -> pdev ,
972
972
O2_SD_LOCK_WP , & scratch );
973
973
if (ret )
974
- return ret ;
974
+ goto read_fail ;
975
975
976
976
scratch &= 0x7f ;
977
977
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
978
978
979
979
ret = pci_read_config_dword (chip -> pdev ,
980
980
O2_SD_PLL_SETTING , & scratch_32 );
981
981
if (ret )
982
- return ret ;
982
+ goto read_fail ;
983
983
984
984
if ((scratch_32 & 0xff000000 ) == 0x01000000 ) {
985
985
scratch_32 &= 0x0000FFFF ;
@@ -998,7 +998,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
998
998
O2_SD_FUNC_REG4 ,
999
999
& scratch_32 );
1000
1000
if (ret )
1001
- return ret ;
1001
+ goto read_fail ;
1002
1002
scratch_32 |= (1 << 22 );
1003
1003
pci_write_config_dword (chip -> pdev ,
1004
1004
O2_SD_FUNC_REG4 , scratch_32 );
@@ -1017,7 +1017,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
1017
1017
ret = pci_read_config_byte (chip -> pdev ,
1018
1018
O2_SD_LOCK_WP , & scratch );
1019
1019
if (ret )
1020
- return ret ;
1020
+ goto read_fail ;
1021
1021
scratch |= 0x80 ;
1022
1022
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
1023
1023
break ;
@@ -1028,7 +1028,7 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
1028
1028
/* UnLock WP */
1029
1029
ret = pci_read_config_byte (chip -> pdev , O2_SD_LOCK_WP , & scratch );
1030
1030
if (ret )
1031
- return ret ;
1031
+ goto read_fail ;
1032
1032
scratch &= 0x7f ;
1033
1033
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
1034
1034
@@ -1057,13 +1057,16 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
1057
1057
/* Lock WP */
1058
1058
ret = pci_read_config_byte (chip -> pdev , O2_SD_LOCK_WP , & scratch );
1059
1059
if (ret )
1060
- return ret ;
1060
+ goto read_fail ;
1061
1061
scratch |= 0x80 ;
1062
1062
pci_write_config_byte (chip -> pdev , O2_SD_LOCK_WP , scratch );
1063
1063
break ;
1064
1064
}
1065
1065
1066
1066
return 0 ;
1067
+
1068
+ read_fail :
1069
+ return pcibios_err_to_errno (ret );
1067
1070
}
1068
1071
1069
1072
#ifdef CONFIG_PM_SLEEP
0 commit comments