Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp127514ybi; Wed, 29 May 2019 18:05:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAeVaZTNE38DU4fu47dfpc+Jg4G1ggD0lSaWbq2Gsk44WleNo6rRW7abfqeU4XEewEAXYN X-Received: by 2002:a17:90a:c303:: with SMTP id g3mr689265pjt.58.1559178319960; Wed, 29 May 2019 18:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559178319; cv=none; d=google.com; s=arc-20160816; b=PjOc/Y9UI3xwkf+mY6+tjcSz+xGUgp8nxJTnk3ET0Ube5tQdVc26Hzo7uBsIpYP//2 F8t+fXTA+c+CPiOlM8YgYaVg8u6HBQCMQYITt9jn2CX5WKzSbwOuhfKjlatbtwpImT3v O8MEQduka0Ak8SwZu+lHF0BUJn0hMoh8/9yPMFJzhFMA9j63aRIZl3v0UTkbTHAlWVRR T6pBSlfBiAjvPi3AlmwQeHV42inDbylHdaKPe62pzNuqCnmY8lM5ORSOhHCrQ1ra+Iu6 e9eLx+6KbkmX/dDGwm7QAUlDP8QJ60KdGrxAOXx8xD0RCUlRoKwY61NLH4ZYy38Syh8u rJKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:cc:to:subject :dkim-signature:dkim-filter; bh=WU7NjXvms7IJ51rdPPyc3YgEvtiF8en+bDubhF/CN+w=; b=UyWakaVnmIqzVYPlsNRSWegtg9JrdYF02WK7XYywcmfg2O08loyRRDus2GWYB5SI1M HyMy0wqPdWKiZtCdEd3izCWwVCbP5rLTHxyknFFpyIo4ifOyYm8SmDAGWudavOCki5oz +3Hymoh1hYiyuKOUqA3T22Bn3gbfaN+EoTQIiOUpIRBrsFdkBigTYckV5QyX0GI38YOT 5py8tB6ZLo2k6zS10e3T/DjIDzHAPET2pKoqICNYmPPWWDFFb3+r6KpMUrlAMA5AB3Vy bBGOyFQVp9N+G/cU7I01+tdFLF6jw8E2ND8bRQ4nwPFh2H/pE6Q53p1qGa5xerYjhPJM GpSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SWUmxFsF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si1100728pjs.87.2019.05.29.18.05.02; Wed, 29 May 2019 18:05:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SWUmxFsF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbfE3BDw (ORCPT + 99 others); Wed, 29 May 2019 21:03:52 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:40298 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbfE3BDv (ORCPT ); Wed, 29 May 2019 21:03:51 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190530010349epoutp03f667d6e7da35a3ecafdfca1039f47104~jUFam3U8N1181611816epoutp035 for ; Thu, 30 May 2019 01:03:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190530010349epoutp03f667d6e7da35a3ecafdfca1039f47104~jUFam3U8N1181611816epoutp035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1559178229; bh=WU7NjXvms7IJ51rdPPyc3YgEvtiF8en+bDubhF/CN+w=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=SWUmxFsFNjBxp7P19xFuOxP0Ct71gdErtAYDuDGARkmsSoaGTFEHV2HSPch6PHdyZ aFM/vwu4yKuLrtKCD4AgvkxP/PVY09/Q7VK2NZaJHAowqpu28Nn3qobHw6Oe0wzGPy zt/e4A7Vx6Dc28gKI/Qxs+cAFL2Het1urULYryZM= Received: from epsmges1p3.samsung.com (unknown [182.195.40.157]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190530010346epcas1p440541c66431e5b7bb49d00c8e3d6bcb9~jUFX4Y77k0805908059epcas1p4F; Thu, 30 May 2019 01:03:46 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id D5.60.04143.EEB2FEC5; Thu, 30 May 2019 10:03:42 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20190530010342epcas1p35c4fb5686a2f124e43b651afa2cd0efd~jUFUCXkAn1055610556epcas1p3Q; Thu, 30 May 2019 01:03:42 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190530010342epsmtrp294e0fea086653ae83c2dd0cf786f0aa6~jUFUBk-Me2307923079epsmtrp2W; Thu, 30 May 2019 01:03:42 +0000 (GMT) X-AuditID: b6c32a37-f19ff7000000102f-fa-5cef2beeb685 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EE.39.03692.DEB2FEC5; Thu, 30 May 2019 10:03:41 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190530010341epsmtip1a43dcab5cf6582820ee829c1c341b378~jUFT3QDKj0633606336epsmtip1x; Thu, 30 May 2019 01:03:41 +0000 (GMT) Subject: Re: [PATCH v2] extcon: arizona: Correct error handling on regmap_update_bits_check To: Charles Keepax Cc: myungjoo.ham@samsung.com, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org From: Chanwoo Choi Organization: Samsung Electronics Message-ID: Date: Thu, 30 May 2019 10:05:39 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190529094605.9838-1-ckeepax@opensource.cirrus.com> Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0hTURzHOXtcr+byNl8/RdRdicgyvW6zlQ/CSgYZGdKDUtdFTyruxe4m WQSWZTqijAjJrKSXZkWyTEuK1bLEQZFokJoVNOhF01pmL6jdXSP/+5zf+ZzzO99zDimWNxKx ZKXRii1GVk8TIZKeB4tTU7xLJovSHIMKzchBB9IM97USmvF9HYTGN+mUrpJom1v/IO2R7k6k 9TniC8TbqrIqMFuGLYnYWGoqqzSWZ9PrCnWrdeqMNCaFWaFZTicaWQPOptfkF6TkVer93ejE alZv85cKWI6jU3OyLCabFSdWmDhrNo3NZXrzCvMyjjVwNmP5slKTYSWTlpau9os7qiquXWwK Mj+O2vXSfUVai/bL7YgkgVLBGXehHQWTcuoWgk/uLDsK8fMXBFebvUHCxDcEk700z7zvOjcl EqS7CKZudEqEwSSCrw+9BG+FU8Xws3cG8RxBpcPngTERz2JqO7T5LgUcgkoG57vnAQ6jFPDs +5uAL6Ny4EDPUMCXUAvh98wxKc+R1FZ49ahLKjgLYPCkR8JzMJUL7on3s/tHw5jn7CwnQN3N U2L+cED1E9DsGw8SIq+BvuEaIU04fBjoDhI4Fnzeu4TAe+DyYD8hr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cf2xFyKJr19jqmx3K6cRo+PzJVmDcvFghU zd1x6L6FXofe244y9eObn75efrbJZ+a8DQ9ZQyRNf/65/Cray2Gp78Pgou0/p/oEp7nHCxxT r9vd9X/edDfv+4umJJlHLAlrl552/kM1m7mZEktxRqKhFnNRcSIA6X8QzYkCAAA= X-CMS-MailID: 20190530010342epcas1p35c4fb5686a2f124e43b651afa2cd0efd X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20190529094610epcas5p35754e16753663dfa2ecadf0e410d619a References: <20190529094605.9838-1-ckeepax@opensource.cirrus.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Charles, On 19. 5. 29. 오후 6:46, Charles Keepax wrote: > Ensure the case when regmap_update_bits_check fails and the change > variable is not updated is handled correctly. > > Signed-off-by: Charles Keepax > --- > > Changes since v1: > - Print error message in driver remove > > Thanks, > Charles > > drivers/extcon/extcon-arizona.c | 33 ++++++++++++++++++++------------- > 1 file changed, 20 insertions(+), 13 deletions(-) > > diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c > index 9327479c719c2..519e89aedd4a0 100644 > --- a/drivers/extcon/extcon-arizona.c > +++ b/drivers/extcon/extcon-arizona.c > @@ -335,10 +335,12 @@ static void arizona_start_mic(struct arizona_extcon_info *info) > > arizona_extcon_pulse_micbias(info); > > - regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, > - ARIZONA_MICD_ENA, ARIZONA_MICD_ENA, > - &change); > - if (!change) { > + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, > + ARIZONA_MICD_ENA, ARIZONA_MICD_ENA, > + &change); > + if (ret < 0) { > + dev_err(arizona->dev, "Failed to enable micd: %d\n", ret); > + } else if (!change) { > regulator_disable(info->micvdd); > pm_runtime_put_autosuspend(info->dev); > } > @@ -350,12 +352,14 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) > const char *widget = arizona_extcon_get_micbias(info); > struct snd_soc_dapm_context *dapm = arizona->dapm; > struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); > - bool change; > + bool change = false; > int ret; > > - regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, > - ARIZONA_MICD_ENA, 0, > - &change); > + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, > + ARIZONA_MICD_ENA, 0, > + &change); > + if (ret < 0) > + dev_err(arizona->dev, "Failed to disable micd: %d\n", ret); > > ret = snd_soc_component_disable_pin(component, widget); > if (ret != 0) > @@ -1727,12 +1731,15 @@ static int arizona_extcon_remove(struct platform_device *pdev) > struct arizona *arizona = info->arizona; > int jack_irq_rise, jack_irq_fall; > bool change; > + int ret; > > - regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, > - ARIZONA_MICD_ENA, 0, > - &change); > - > - if (change) { > + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, > + ARIZONA_MICD_ENA, 0, > + &change); > + if (ret < 0) { > + dev_err(&pdev->dev, "Failed to disable micd on remove: %d\n", > + ret); > + } else if (change) { > regulator_disable(info->micvdd); > pm_runtime_put(info->dev); > } > Applied it. Thanks. -- Best Regards, Chanwoo Choi Samsung Electronics