From 01d1d7b2ec57aa3327c6a3acd340c40a9936a205 Mon Sep 17 00:00:00 2001 From: Stuart Henderson Date: Wed, 1 Nov 2017 15:07:46 +0000 Subject: [PATCH] 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 --- drivers/extcon/extcon-madera.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.20.1