From patchwork Tue Jun 23 19:58:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223351 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.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 DDB79C433E1 for ; Tue, 23 Jun 2020 20:53:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE42720738 for ; Tue, 23 Jun 2020 20:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945602; bh=SgV5cgpPQst53QtexAFdvgpyzPThItA8o3g8CM1WL5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=m+ba0HCVbG/prBdQoRvk4GTqIgGH9HreukgxsMhzWqoRkbP/5IRqZcX/ygLDdC1LT bK4Avh5dkm6tNKrWKao79Cx6d7mUDqBz8b0uIN3kasmoCQnlxblUUVHOE8J5Xt0vcb w9woqJ0GzfSWRAQj4JgF1EqFHa268dNykV+X9HXs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392875AbgFWUqu (ORCPT ); Tue, 23 Jun 2020 16:46:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:44904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392869AbgFWUqt (ORCPT ); Tue, 23 Jun 2020 16:46:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5926B21548; Tue, 23 Jun 2020 20:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945208; bh=SgV5cgpPQst53QtexAFdvgpyzPThItA8o3g8CM1WL5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWTdAUlDZql0EZ4boTihFh10G69B3I8Cg5gI48VOWwBBqCE0ExbEqmHcmdMupDowq 2Ke3/HJu+rcexs5Od7H9n+jAYJDaR7/mVkcFFkchqJ/vVTD/ynuO3m1fh8vjNWQNkl 2e95ViSSnOS2/6xcEf64B8fD4DQNKFUEYjLsiEvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Chanwoo Choi , Sasha Levin Subject: [PATCH 4.14 082/136] extcon: adc-jack: Fix an error handling path in adc_jack_probe() Date: Tue, 23 Jun 2020 21:58:58 +0200 Message-Id: <20200623195307.818861863@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 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 6f6537ab0a791..59e6ca685be85 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; }