From: Stuart Henderson Date: Wed, 1 Nov 2017 15:07:46 +0000 (+0000) Subject: extcon: madera: Ensure micd read failures are caught X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9cf5fa64c2753d570a38f0115d4fd6adaf8713e4;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git extcon: madera: Ensure micd read failures are caught The use of madera_ohm_to_hohm was causing an error code to be lost when passed to the .reading function. Change-Id: Ie1741b47fb7491ba33d1dd5f9580dc975c130d9b Signed-off-by: Stuart Henderson --- diff --git a/drivers/extcon/extcon-madera.c b/drivers/extcon/extcon-madera.c index f85370d215cb..e01caf272f6d 100644 --- a/drivers/extcon/extcon-madera.c +++ b/drivers/extcon/extcon-madera.c @@ -2117,9 +2117,12 @@ static void madera_micd_handler(struct work_struct *work) if (ret == -EAGAIN) goto out; - dev_dbg(info->dev, "Mic impedance %d ohms\n", ret); + if (ret >= 0) { + dev_dbg(info->dev, "Mic impedance %d ohms\n", ret); + ret = madera_ohm_to_hohm((unsigned int)ret); + } - madera_jds_reading(info, madera_ohm_to_hohm((unsigned int)ret)); + madera_jds_reading(info, ret); out: madera_jds_start_timeout(info);