@@ -935,6 +935,9 @@ static int gpio_pca_series_pin_configure(const struct device *dev,
935
935
/* configure PCA_REG_TYPE_1B_OUTPUT_CONFIG */
936
936
ret = gpio_pca_series_reg_cache_read (dev ,
937
937
PCA_REG_TYPE_1B_OUTPUT_CONFIG , (uint8_t * )& reg_value );
938
+ if (ret != 0 ) {
939
+ goto out ;
940
+ }
938
941
reg_value = sys_le32_to_cpu (reg_value );
939
942
if (flags & GPIO_SINGLE_ENDED ) {
940
943
reg_value |= (BIT (pin )); /* set bit to set open-drain */
@@ -944,13 +947,19 @@ static int gpio_pca_series_pin_configure(const struct device *dev,
944
947
reg_value = sys_cpu_to_le32 (reg_value );
945
948
ret = gpio_pca_series_reg_write (dev ,
946
949
PCA_REG_TYPE_1B_OUTPUT_CONFIG , (uint8_t * )& reg_value );
950
+ if (ret != 0 ) {
951
+ goto out ;
952
+ }
947
953
}
948
954
949
955
if ((cfg -> part_cfg -> flags & PCA_HAS_PULL )) {
950
956
if ((flags & GPIO_PULL_UP ) || (flags & GPIO_PULL_DOWN )) {
951
957
/* configure PCA_REG_TYPE_1B_PULL_SELECT */
952
958
ret = gpio_pca_series_reg_cache_read (dev ,
953
959
PCA_REG_TYPE_1B_PULL_SELECT , (uint8_t * )& reg_value );
960
+ if (ret != 0 ) {
961
+ goto out ;
962
+ }
954
963
reg_value = sys_le32_to_cpu (reg_value );
955
964
if (flags & GPIO_PULL_UP ) {
956
965
reg_value |= (BIT (pin ));
@@ -960,10 +969,16 @@ static int gpio_pca_series_pin_configure(const struct device *dev,
960
969
reg_value = sys_cpu_to_le32 (reg_value );
961
970
ret = gpio_pca_series_reg_write (dev ,
962
971
PCA_REG_TYPE_1B_PULL_SELECT , (uint8_t * )& reg_value );
972
+ if (ret != 0 ) {
973
+ goto out ;
974
+ }
963
975
}
964
976
/* configure PCA_REG_TYPE_1B_PULL_ENABLE */
965
977
ret = gpio_pca_series_reg_cache_read (dev ,
966
978
PCA_REG_TYPE_1B_PULL_ENABLE , (uint8_t * )& reg_value );
979
+ if (ret != 0 ) {
980
+ goto out ;
981
+ }
967
982
reg_value = sys_le32_to_cpu (reg_value );
968
983
if ((flags & GPIO_PULL_UP ) || (flags & GPIO_PULL_DOWN )) {
969
984
reg_value |= (BIT (pin )); /* set bit to enable pull */
@@ -973,6 +988,9 @@ static int gpio_pca_series_pin_configure(const struct device *dev,
973
988
reg_value = sys_cpu_to_le32 (reg_value );
974
989
ret = gpio_pca_series_reg_write (dev , PCA_REG_TYPE_1B_PULL_ENABLE ,
975
990
(uint8_t * )& reg_value );
991
+ if (ret != 0 ) {
992
+ goto out ;
993
+ }
976
994
}
977
995
978
996
/* configure PCA_REG_TYPE_1B_OUTPUT */
@@ -1013,6 +1031,10 @@ static int gpio_pca_series_pin_configure(const struct device *dev,
1013
1031
/* configure PCA_REG_TYPE_1B_CONFIGURATION */
1014
1032
ret = gpio_pca_series_reg_cache_read (dev ,
1015
1033
PCA_REG_TYPE_1B_CONFIGURATION , (uint8_t * )& reg_value );
1034
+ if (ret != 0 ) {
1035
+ goto out ;
1036
+ }
1037
+
1016
1038
reg_value = sys_le32_to_cpu (reg_value );
1017
1039
if (flags & GPIO_INPUT ) {
1018
1040
reg_value |= (BIT (pin )); /* set bit to set input */
0 commit comments