Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6237602iob; Tue, 10 May 2022 13:37:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7L20AtdBqaxMf4xNy1T95K6k4h9QYCmF67YMN8qSDoq6MZ+kVwJUQ/h0ejiOUhK0xn+R4 X-Received: by 2002:a17:907:2cc3:b0:6fa:55f:8805 with SMTP id hg3-20020a1709072cc300b006fa055f8805mr12612764ejc.46.1652215076447; Tue, 10 May 2022 13:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652215076; cv=none; d=google.com; s=arc-20160816; b=EXqnLhcy95L5Ze8IyG694JLKc09011GJBEUswwkQCYkM0gKaPyGQikFo0mQhSfAjYf nffysS4wxt50EUUvSFpxAxukeneh4KOAc/IgZ/m55MWlApWqRsplXzSJ+t7DZlNU1k6e d3+wynnZy/LvH4ftliK2dhhlDwMAja1qsmpnAvSqNSrau0h0sy4uVsdUHHRY9zATzooP FNwezG31gYIQuXjOmLgbV5ZTjNxCX7UElEfTMZx2DW566yQrtKpV5NYEdDY/33FVgMRT 9VDtphbD06R+uwYzTaOPia2oqXmxITJyB6uH9vWVBWAnn7BDntJUgHbkilvLvbhHf2cs 5gnA== 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=og8s1x3te8m/1frrFeVsD6Z4I0dbsZ9hZUXiWdUlkmA=; b=LtM2cyZoIifqPdCf9ZJ5RseY3W5ivnE9UqckWmWRveNbSuHxiN97pAlnWknsceG+VY Dk64k141B20RZSjHTOEv+0lWPt6IYQU1qhPwOWz6cr8jutBue1IcrzBj9/vKz0mjb4XT jaVo79ZklH2eWuvLjjqVyi64ECTR0mreqghUgHX4U1dCriWeGfXKJOu9cV/SKHTiG3dA dLpVHgMQ7rsVYP6IHZ3+1AF2f7e/XW51C61k8Lu/R3YFH3cHWkooFR4/8gfWJH6k3BBC +Y0wPmiSS3ehZDZqVM0vaBZsTTYDmcxl06QrVeJiIf3JtwWfi5a0L3pZ+X0Ae+y/gUlz OsNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z1H3dvzv; 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 ne26-20020a1709077b9a00b006df76385cf7si434220ejc.407.2022.05.10.13.37.32; Tue, 10 May 2022 13:37:56 -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=z1H3dvzv; 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 S243046AbiEJNXo (ORCPT + 99 others); Tue, 10 May 2022 09:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242972AbiEJNVO (ORCPT ); Tue, 10 May 2022 09:21:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C332C0D1D; Tue, 10 May 2022 06:14:25 -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 697E461574; Tue, 10 May 2022 13:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B600C385C6; Tue, 10 May 2022 13:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652188464; bh=Za0+Kg0GzcGKimpUtf0svjSHqpztZKZgkSCW3XGCFmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1H3dvzvr0plHbXvGQoBUxBCrdxWBJSz+Plt5F7k4dPCn8MftXQHSVM+WoQaTkW/1 j2sChWl1VdV/rlgdl3DPa2pFkBVx/kqZ0xbOG5A+xqtfHAA8A0EfD2NUVe/3c4e9Q3 kGEfoR52+JypcWkJ3k7najC+ZUwMbDbKHOrHwPeo= 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 4.14 17/78] iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() Date: Tue, 10 May 2022 15:07:03 +0200 Message-Id: <20220510130733.042088677@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.522479698@linuxfoundation.org> References: <20220510130732.522479698@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,URIBL_BLOCKED autolearn=unavailable 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 @@ -404,6 +404,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; } /*