From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB86EC433E0 for ; Thu, 18 Jun 2020 01:57:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C10BE20885 for ; Thu, 18 Jun 2020 01:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592445463; bh=F7qbqL1Z+GbMg1N+HaFfBKK6cwEGtVkA9j5hs000wNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h5ru95gCACO/OP5bYadbr8XPLEh7p/1MBgPoS4NwGPowRWsdaOe5xg74/NDG1DwL8 xkVQNLyiXAwqKGKCudl9xryXb+xax4LF4xq063eNBiUIJWbYz7c1NPAD0wjcxmNztZ cxo6X4otQBQ8thZW8tDWY2oFApK52xmiKkMqLsiA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729436AbgFRB5e (ORCPT ); Wed, 17 Jun 2020 21:57:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:60136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731357AbgFRBZH (ORCPT ); Wed, 17 Jun 2020 21:25:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BDE8C221F1; Thu, 18 Jun 2020 01:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592443507; bh=F7qbqL1Z+GbMg1N+HaFfBKK6cwEGtVkA9j5hs000wNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZxEngux8K33UpCAgVfUXRQAh7uOZtlqzMDySARQ2ErhoWzO455bGE26B15BIy6sc DhZqS4N7u2z8uztXuqpNcTvZc13djm/5//T/CHaWEsxi9ZqNK4f/tPBRBtN/kUzW1r fgUkxmx93rCG0lL/Hrz2jgsovb3hFA1Vxxu7DuuQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Chanwoo Choi , Sasha Levin Subject: [PATCH AUTOSEL 4.19 132/172] extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' Date: Wed, 17 Jun 2020 21:21:38 -0400 Message-Id: <20200618012218.607130-132-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618012218.607130-1-sashal@kernel.org> References: <20200618012218.607130-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christophe JAILLET [ Upstream commit bc84cff2c92ae5ccb2c37da73756e7174b1b430f ] 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 Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- 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 18026354c332..b1fb38b7f270 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c @@ -128,7 +128,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); @@ -170,7 +170,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