Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1963634iob; Thu, 5 May 2022 11:58:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI8nN9Kvx6u2Amp+nkOk2AtuquTPrzgAi77IB5Zun+GRWavtA1K5JSiiSKl81qdsKnwilA X-Received: by 2002:aa7:8094:0:b0:505:b544:d1ca with SMTP id v20-20020aa78094000000b00505b544d1camr27575752pff.26.1651777084147; Thu, 05 May 2022 11:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651777084; cv=none; d=google.com; s=arc-20160816; b=ZCvDiAIZVRVV6uFFOlZ7vmTJEhHgTvfLcGZPXX/Px9L39UfyBoyhooObLBSm5uH7Ok /O2SzD4FGzmsFaUIiHaN1GyvIlhQz+6uFrmbgrwxB4DA+RaTAHgHuVyq5REm2XSGL5N8 fC2/LYOu7/8Lmdc/1FDMOT6ciQXqFgycz1AifAl12hq9zQCJP7EeAYEgXpkfzFGUOcDh lR+/KV2SuFgLUa3tyBuGKGnOn5luzsNyA8axhU+/SCFgP4L7vdZUcy9A3sCrjovdiuQ+ QnSwzIpCVzdz6zUiOMUdoAoWmhC0V026CH7BldGSFw02AdUcBwVUeDzzULutZbE5+2C2 u5zA== 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=P34WjxZZ8UKHF734S9f6+8ETMWV1HdIDIFIhwXaC6t0=; b=w1CJ0Sic5urqxrXCXFwjSnMz6Qguvm6YqQ90X8IPt7Gmf0+cZ6MxJG6oQJ7FPAdXE2 ogJcn080oEixhImdvLYJoXYi7RrriMKyPUsvj2I8Vgjxgoye7kN7gKTik7sr9c7agsb7 Y+y75WOkXmJbqx+tL3QvVHwyww9JAtOT3hqLMHMkzevuxWT4doBYZKdJHcm6Um/gZ3DZ 5wQGxRbvrOeWV1812/XGuw8QqB9w90+H+K3B7odSe0EFlL0L0Jn5F75inmAz4XCJ+Av/ 40wmMhJfwsduQU3J33PVEathLrtjY5jQSbYVJ4i0AOutjps367kqLBfnM/JCbgOZfi9q lliQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p+GKl65d; 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 q8-20020a170902dac800b0015d3a9ee940si3016981plx.149.2022.05.05.11.57.44; Thu, 05 May 2022 11:58:04 -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=p+GKl65d; 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 S1353925AbiEDQxN (ORCPT + 99 others); Wed, 4 May 2022 12:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353737AbiEDQwL (ORCPT ); Wed, 4 May 2022 12:52:11 -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 9C09E4706C; Wed, 4 May 2022 09:48:32 -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 5ECB5B82553; Wed, 4 May 2022 16:48:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00721C385A4; Wed, 4 May 2022 16:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651682910; bh=BUOk1zYNp2SO4CFbYAyT2aAi+mKxa4j9bzGzbW0e+FA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+GKl65dui3dXZR0sF4GRkrzThJSCAtC17IkCueEv85Or6ajJf07YF8y+zwMHqeb6 YkQHV0aW5uzRFczrUdBinUfdOfmJB5NCzs7lIr+GD+ntULZKKj37BZ8DVc6V4xOVJu LnojNrua3KgpZt3gaZnOPWaqLV0fzHh6kH602Jmo= 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.4 16/84] iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() Date: Wed, 4 May 2022 18:43:57 +0200 Message-Id: <20220504152928.939190636@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504152927.744120418@linuxfoundation.org> References: <20220504152927.744120418@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 @@ -391,6 +391,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; } /*