Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp988314ybk; Sun, 10 May 2020 02:54:56 -0700 (PDT) X-Google-Smtp-Source: APiQypIQTkwMiZBsghdj7GPklN6ptYwExrIwemY0HJLPxNgyHf15bhGqFBxC9gqtLjTYgs6Ne+D1 X-Received: by 2002:a17:906:a856:: with SMTP id dx22mr6241214ejb.255.1589104496209; Sun, 10 May 2020 02:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589104496; cv=none; d=google.com; s=arc-20160816; b=m5IUDTi1XsvdP5rRzimhtzPbOqgxu3elLyL0oIDUfbS7gD+12RQflEEnEBaO238LUW yZh+r9iV97OXZMrrojPQCHqvePbVasJGbSdbe9YlBTD62Pji2e85jeuN4X2eb4Q2wecm 3qTbyYHn2ZQq/aZr9Yfz5Q8vty2Wt7mlEn4839ll2iWq3NAcWccnjiPBON1/iamddBDc mgGJNc1CVYU3t9ZdFXFz9kC8p3xTRMqQtjPE8xwKhszbIKOE5sC+qUP3bYuQrMDgHAER KW+35bvXEBonR9sBQnlw9yk9ek9mMoMy71KaVqG4UyrvQRQ8g6R6M3cKJfo0GTEcAnb1 MWCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TQ3ONooejt7ML1KjfdGDZpNEy9u9BwV34w1k1zT925o=; b=K9Nuwg9241mEnJuMJtjXxFphg9UKIVER56APcTvso60cJh7qKpExtM+hvazejCrKvI /GrKdSV6MExM+V0J0IzAeOVz41QFSikETqQcfk8pGATwyJt3pCvt8vMB9s1p+lFsguCG xdI8ZHuVqKKdSoDF/5Fy93Pb7ZxYuLuqooIMOFRBmatXkU2cYKxFMjhfvF+LaEO4EooZ +PWgwyRnNx9Co4AsedCYvNR8v64Y3571KUqUVuCOmF9umTbOf5XytXU0c+0gZYgssOx/ l+lmnwlxs+mW4EIICTAWsFaAClqn/O+diMaV2jXQ3zRZkq3NbiuVDtgxfgp//NNzmx+b l3mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si3953539ejw.454.2020.05.10.02.54.33; Sun, 10 May 2020 02:54:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725994AbgEJJxM (ORCPT + 99 others); Sun, 10 May 2020 05:53:12 -0400 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:50895 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726704AbgEJJxM (ORCPT ); Sun, 10 May 2020 05:53:12 -0400 Received: from localhost.localdomain ([92.148.185.155]) by mwinf5d81 with ME id cxt42200D3MbWjg03xt55s; Sun, 10 May 2020 11:53:09 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 10 May 2020 11:53:09 +0200 X-ME-IP: 92.148.185.155 From: Christophe JAILLET To: myungjoo.ham@samsung.com, cw00.choi@samsung.com, anish198519851985@gmail.com, gregkh@linuxfoundation.org, jic23@kernel.org, lars@metafoo.de Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' Date: Sun, 10 May 2020 11:53:03 +0200 Message-Id: <20200510095303.231635-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some error handling paths, a call to 'iio_channel_get()' is not balanced by a corresponding call to 'iio_channel_release()'. This can be achieved easily by using the devm_ variant of 'iio_channel_get()'. This has the extra benefit to simplify the remove function. Fixes: 19939860dcae ("extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices") Signed-off-by: Christophe JAILLET --- This patch in a more complete version than commit 5a696d9760fe ("extcon: adc-jack: Release IIO channel on driver remove") which fixed the issue for the remove function only. --- drivers/extcon/extcon-adc-jack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index ad02dc6747a4..0317b614b680 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c @@ -124,7 +124,7 @@ static int adc_jack_probe(struct platform_device *pdev) for (i = 0; data->adc_conditions[i].id != EXTCON_NONE; i++); data->num_conditions = i; - data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); + data->chan = devm_iio_channel_get(&pdev->dev, pdata->consumer_channel); if (IS_ERR(data->chan)) return PTR_ERR(data->chan); @@ -164,7 +164,6 @@ static int adc_jack_remove(struct platform_device *pdev) free_irq(data->irq, data); cancel_work_sync(&data->handler.work); - iio_channel_release(data->chan); return 0; } -- 2.25.1