Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4466591rwb; Tue, 6 Sep 2022 07:58:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR7DjmU52RF/3yJrAlEgpJ+SViZKqteuQwWJ3tScg9RljnKS4PzvAo0F5Cy8ZCnh8I9xojRc X-Received: by 2002:a17:90a:4d8a:b0:200:183a:10ad with SMTP id m10-20020a17090a4d8a00b00200183a10admr17813892pjh.171.1662476302664; Tue, 06 Sep 2022 07:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476302; cv=none; d=google.com; s=arc-20160816; b=RZclETS6xQEViV3Rn5BFOuwgCYZ9e8bSFeqVsnijwHCaqBcSVM6sSwZs3iUQfDU9v2 cjMyR/u47/0E8pm9FdA5UfeEV8a8XaEyWOvkAqABLo9OynZ8YTotzOW8ApQTrFk1hK6E B2w3CE/UskAnQRaNuCAWs/YEDueD5s/SP3lH6/D8MTP5F0TAz7uwQXgafkNrsrneUr9J g6ZCBwjs3o/ZD07gUaZGnFvDwgioHm50w870paW3on/cqdGofqDuRLbVNiip/sFlzAwp l8bTRSbTi1MqMY0HJIVGTIHqijhYRDFVeCa7leH5IwM+q79+7mKtu/nuLc8n+CvOLOVD j2Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uKhhfeoPXirs1JbzL4ZNDjEDf0ycQNJ/IT5MA4JxP94=; b=o6YXtbrW1Zs/UyyzkmYmf7FdORTMMsEK8OZcGqCnlkriiPjtdV0dLnO2qjuoksgY/S HIwX0kIfjHF8KEkbxnv9IqyHA+ZSyF4yxEl7LVZmme/9lA6aulwpflfCzQ36XDxtEg3E 9Z7jN2ajarg8t+e58seg3I3ph73Ynd1WzR586Br5XVhAmjx2FUNk+YRdc16yeR/gIon6 oIJiDm1GK69UaltjmR6m/shnz4wBGK4ch6zn9/pLmWUriI+VQgM2cS4SwH0F7JmiI7hY MT2Ti73qUSWIKIOMValw3jEDp5CbINeX2d8RDNiob9Aquq+TkpnBedyMv31BvbeL3R1V SeLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b6XJYvUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a63ee4f000000b0042c3dd6e3ecsi14403109pgk.527.2022.09.06.07.58.11; Tue, 06 Sep 2022 07:58:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b6XJYvUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240568AbiIFNeU (ORCPT + 99 others); Tue, 6 Sep 2022 09:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240601AbiIFNdl (ORCPT ); Tue, 6 Sep 2022 09:33:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94757963B; Tue, 6 Sep 2022 06:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A18D261512; Tue, 6 Sep 2022 13:33:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3967C433C1; Tue, 6 Sep 2022 13:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471184; bh=fzWAUC9vWCWWt4iO14mEC8kaEeLw3ASxsqxFd7k+NH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6XJYvUlACpHfeVnfLhQafPstR/r6bMQ5Hx7RkTXwPiOr2znyC39otmt/n9BVTBnh DGhW3FgSMADmNdiUUXDxK/bVwfHtTZVFMLP4DNYADwsqm8zbkqgJTj05dMsYNNynPd IRy/0JY3xNzf86PONH0K57mKOe6CBkU0RX6Tlhtk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matti Vaittinen , Marcelo Schmitt , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 27/80] iio: ad7292: Prevent regulator double disable Date: Tue, 6 Sep 2022 15:30:24 +0200 Message-Id: <20220906132818.080304698@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132816.936069583@linuxfoundation.org> References: <20220906132816.936069583@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matti Vaittinen commit 22b4277641c6823ec03d5b1cd82628e5e53e75b7 upstream. The ad7292 tries to add an devm_action for disabling a regulator at device detach using devm_add_action_or_reset(). The devm_add_action_or_reset() does call the release function should adding action fail. The driver inspects the value returned by devm_add_action_or_reset() and manually calls regulator_disable() if adding the action has failed. This leads to double disable and messes the enable count for regulator. Do not manually call disable if devm_add_action_or_reset() fails. Fixes: 506d2e317a0a ("iio: adc: Add driver support for AD7292") Signed-off-by: Matti Vaittinen Tested-by: Marcelo Schmitt Link: https://lore.kernel.org/r/Yv9O+9sxU7gAv3vM@fedora Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ad7292.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/iio/adc/ad7292.c +++ b/drivers/iio/adc/ad7292.c @@ -289,10 +289,8 @@ static int ad7292_probe(struct spi_devic ret = devm_add_action_or_reset(&spi->dev, ad7292_regulator_disable, st); - if (ret) { - regulator_disable(st->reg); + if (ret) return ret; - } ret = regulator_get_voltage(st->reg); if (ret < 0)