From: Mark Brown Date: Tue, 27 Nov 2012 07:14:26 +0000 (+0900) Subject: extcon: arizona: Only set GPIO if it has been requested X-Git-Tag: firefly_0821_release~3680^2~1077^2~8^2~19 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cd74f7b3b387cbc6153b15c100982bac119af753;p=firefly-linux-kernel-4.4.55.git extcon: arizona: Only set GPIO if it has been requested The micd_pol GPIO is only requested if we've specified one greater than 0 so apply the same test before we set it. Signed-off-by: Mark Brown Signed-off-by: Chanwoo Choi Signed-off-by: Myungjoo Ham --- diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 7dbefe8fe5c2..9e1d104803e7 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -85,8 +85,9 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode) { struct arizona *arizona = info->arizona; - gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio, - info->micd_modes[mode].gpio); + if (arizona->pdata.micd_pol_gpio > 0) + gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio, + info->micd_modes[mode].gpio); regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1, ARIZONA_MICD_BIAS_SRC_MASK, info->micd_modes[mode].bias);