Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3195181iob; Fri, 6 May 2022 22:10:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsIgwGsHny1bjqZYs6kJrq0Hgjn7C80R5qUp8yhJOcYyyNdOqVdPSNjik8LUtw5nt7KuXS X-Received: by 2002:a17:90a:4813:b0:1c9:e5c3:5abf with SMTP id a19-20020a17090a481300b001c9e5c35abfmr16201954pjh.139.1651900211375; Fri, 06 May 2022 22:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651900211; cv=none; d=google.com; s=arc-20160816; b=AiZYecAGavlygGKs8NTxDvZUklRfnp4v5n1ayRUZJdnAD1mcK4zBfYbEsogvPGgXB6 OiJWt9YUItvJ+SYHI4SEpl3r6CxJEvdMiVqYPB+W1eulltJKQQQZkvyJlmKYuvoIfRc4 agpe2eNI78jbk5wQjbqDWGqncw4lh1gTVeVZChajGMESPtTciYv8AHBIovOewA7GTT4p CMZDuqq4RlgJd8dDRwMna/qxMZ1DZ9RLrYLagMnFo0iQWfBAqoiSHc5saT7hddWFzl64 w+IRNCJOHAi/6TtVsnu/KglM2fkJPaI0olbbGIbkyOBqil9Djt/kc7sl0W2lcYkPlkKp BxmQ== 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=2tuxt8Kl7W4eJ4ic+iWoajuxV5PCMPP7zKGWifVO588=; b=mZ2f6X/qpmyPul7ix3cREx8VD55zMmzz+5jk4r6tTcd5WWZk0ESuZ+cAdAFjoW0e8d qAn3cY2PddYOHb+u+IHWh1iYQuJjRooFlXQ1LC5qe7lUniJni4xledwtz0V1XznqlWWO 6DuubpYSvWJYNI0sZGFicdTVABdXvCDSnjMQQIzZ/0fWkM3bsnBKWR0Wzx4NGoiTv9I5 2deHOmGIfsX5EMbKr1iGIbpP0lgXumvxz4lIvdLs+L4kHr3aQn9Cp1eow0U8rQbtpXCw ovH5/2p5CtAtAtOWjVAp55evgJ+wJrWvh3tRznwBcXCq5FUBO60eCEGC3Im52hFLxi4n tEfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BnYqe59q; 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 k1-20020a634b41000000b003c682f6168asi599071pgl.292.2022.05.06.22.09.56; Fri, 06 May 2022 22:10:11 -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=BnYqe59q; 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 S1356307AbiEDRal (ORCPT + 99 others); Wed, 4 May 2022 13:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356807AbiEDRJo (ORCPT ); Wed, 4 May 2022 13:09:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E4B1E3F4; Wed, 4 May 2022 09:55:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id AAE94B82795; Wed, 4 May 2022 16:55:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43222C385AF; Wed, 4 May 2022 16:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683341; bh=vNutgZLg99oCceQySVS0XrEC6vcgEAMD8t8e62pH2v4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BnYqe59qdx737bOQSjUPN/1zcv/iTALfvzWOsameRbZNLP/XzU6kUO2sgUv31Q23O VAVlo/bNwZTzo7TPnVvxCO1Uv4VkDnR7roVxHfQzztipHQTAsbPAwRCjSKx4gVCmyZ fsPad2wuShpo5yWJFJo9mTVf2tLE04vp72iQaaeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.17 016/225] iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() Date: Wed, 4 May 2022 18:44:14 +0200 Message-Id: <20220504153111.708620255@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153110.096069935@linuxfoundation.org> References: <20220504153110.096069935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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: Zheyu Ma commit 3a26787dacf04257a68b16315c984eb2c340bc5e upstream. When the driver fails to enable the regulator 'vid', we will get the following splat: [ 79.955610] WARNING: CPU: 5 PID: 441 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0 [ 79.959641] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 79.967570] Call Trace: [ 79.967773] [ 79.967951] regulator_put+0x1f/0x30 [ 79.968254] devres_release_group+0x319/0x3d0 [ 79.968608] i2c_device_probe+0x766/0x940 Fix this by disabling the 'vdd' regulator when failing to enable 'vid' regulator. Signed-off-by: Zheyu Ma Link: https://lore.kernel.org/r/20220409034849.3717231-2-zheyuma97@gmail.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/magnetometer/ak8975.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -416,6 +416,7 @@ static int ak8975_power_on(const struct if (ret) { dev_warn(&data->client->dev, "Failed to enable specified Vid supply\n"); + regulator_disable(data->vdd); return ret; }