Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1986844iob; Thu, 5 May 2022 12:32:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdTVfntfZI9zNnGoKjBQGnBH74KkS+6/wJoBEvQ70BZ5DbYTo9A+FTvanwDJeje72dKwZ6 X-Received: by 2002:a17:90a:f3c7:b0:1d9:6832:7be0 with SMTP id ha7-20020a17090af3c700b001d968327be0mr7967650pjb.209.1651779174097; Thu, 05 May 2022 12:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651779174; cv=none; d=google.com; s=arc-20160816; b=Td11meHH7tb/tQuyqPOyk3gvzsPoFZXGBzXTKwUMsa9jMDm2QkhKp11P7BtqU6xha8 ANEjobX4mCrnVDz6dK4Wk4AvE4YhgF1MCF8BOPqs46/t5kLi/u6mfEngi7Jw1oVHlECg KNPy5T61TPsCUqMAVzw69dtV6scNDR5GaD2HaKWK9rquu2uX+e1IACnmPrDXObdb8cC/ oXphD24uepIHIxkTd9fTyVl0tKLcpkokxDbwPLq/fM+HskBbFjtnKRIv4dxgqsP+A7p4 rFvPZqmvuhDGkQnBJs5BTE7I2H9nm+bLVRiCHi4uJGeSYSDnQVyeQ2TTmtkQcYBsi1UL lxkg== 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=I38E5qbzN4z7VBtKoawNm34Vx3JpOluw5fVsdRBxX9I=; b=O2FYvKRKCMb2HnR2BU0L0EO1F4rcVFKFFz/0F5VIURydjQlki9H9qKHf7sVFmnPxBa tf6pHS9E9N6biWF7PNz41ybo4DEIQK8jAtdNyVWbShyCQ2lybjUl1395iKBOirYIsgDu R+8yr1JqQ796736P+yhcUtyFvhgIJ3FYDuMH3xqI/nOFYiD8jkkIy/2ZuzWkdAlmLYSR nmZcFByVR+f58cPdoEgPHTqawRMmwWXFonGfvo9/AcoK4bmjsy4I28N0a4mNFDJgd6Wq wbUr1sxbavu9ZB5Tz3czHM6lhX2UUGcCyjwVHAYolD4N7qryRAroUXA9Oi7YAuGvBKI9 xMKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2T6/ktK/"; 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 c24-20020a170902b69800b0015d133dea93si2355596pls.581.2022.05.05.12.32.33; Thu, 05 May 2022 12:32:54 -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="2T6/ktK/"; 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 S1355055AbiEDREF (ORCPT + 99 others); Wed, 4 May 2022 13:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354579AbiEDQ6x (ORCPT ); Wed, 4 May 2022 12:58:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A32A518E30; Wed, 4 May 2022 09:50:35 -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 3E99C61794; Wed, 4 May 2022 16:50:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AFCCC385A4; Wed, 4 May 2022 16:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683034; bh=/1lHACNg12AF4maJVK5N1PfVNsb8YTHvHFzRsME3Q0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2T6/ktK/NSazSUMp9+hl5leGOZyX9f1hweQm5BMVoPgPoHQ+81CfTmuvzC/9fQT+L 4YgRfGGuc9Mkho+wONagPlPYFyheTUWA1BoR+BgLt2Lei9sF9tq8r6Y4U4Z2wAhJB2 MQrpT7QnUzQx30MLdzr8CnGoh+tNK8sTiAVE9dtA= 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.10 015/129] iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on() Date: Wed, 4 May 2022 18:43:27 +0200 Message-Id: <20220504153022.494786909@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@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 @@ -389,6 +389,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; }