Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4694520iob; Sun, 8 May 2022 22:16:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziHpSoYA05LZ8D6GTIihMP0M8ROFAWqX9MIDYRnwNZZi7rfPDPKy/xGO8a27p8caGMFoPj X-Received: by 2002:a17:902:8501:b0:15f:173:40e1 with SMTP id bj1-20020a170902850100b0015f017340e1mr7413063plb.74.1652073407744; Sun, 08 May 2022 22:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652073407; cv=none; d=google.com; s=arc-20160816; b=z3QvnguMfWku0dQlmGqXIY0bE6pK/GnDbX4q72BvWhcqHpjv5iLCOXcn+Oe84d68jC 1BF2GFYIRL+dr0LS8awJ8YPKJQVUaBx8iHcfKo0+WCfZPGiDI9vwdKEZTbfC1e/B7KlT ovKkjESapf7YjNzuJaT/NMtfeQQNdu/QPcvgHKJMPW6m/lW4497teuRxGdfjpHdI/ewN t3f7VH4RzX5shArOeDsUO8ai2g5KxCzhf3OUrWlCphiN0RG7SLXWvz+QTY7PCWSynGvH JGITAyJ7UmBAV0r3DI+xc5suCLbh6GlCT76KAkAMLiPNb95PigzDjraVYN+iHshSpLaE gtfA== 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=zVF68EHOnNeeGsrHxSkmnngS29eUGqBL3ayfSO1n3A8=; b=bZUWoVHPfHhdQLjV1ZurUbnXvcVP8FJmUFZa7USj9nI6nLZuAtWzS+lpQ8fGGyyKJX yYV85PNR5D3DLc1ysX9R+/kTEen/Xxa0GcPmiG7lxz4ry2oWMymgMH0+gmNvokhyBxVB bovCABDLU/3P4+nbLieCJqvFNg82jw+t1VnIaWjA6iboLDhrWELMJmt3toWTa0q5iPNT nVNCZveWypwLWA4oY2dxwc8zAFRKAPsDZA4aU4MkVZkxaaitIHPIvNVbih3E6Woufc40 IWEZorjQLJ2S50b+fgroN6rwd2vkZKC/FAZZ4JrhhdKlCA+QZUjyxPI0VKR8m1eB9pWF R5/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w+K6ksNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o20-20020a056a0015d400b0050d44724426si13785024pfu.341.2022.05.08.22.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w+K6ksNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8F7C42CF22; Sun, 8 May 2022 22:12:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359269AbiEDRvw (ORCPT + 99 others); Wed, 4 May 2022 13:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357202AbiEDROz (ORCPT ); Wed, 4 May 2022 13:14:55 -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 A3C2F54695; Wed, 4 May 2022 09:58: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 ams.source.kernel.org (Postfix) with ESMTPS id 03461B827A3; Wed, 4 May 2022 16:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ACCCC385A4; Wed, 4 May 2022 16:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683488; bh=fl/SlIFa21XcUiuyoHk/hrTxohmhSV+w9p9Ll/WaPjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+K6ksNO9lWs1rsQYL+PuR3I+s4ppijYuj4EgSzvWcRcMeFh3IE9OSMFFJRbGvIzu x9PekTSY4j/cyCSukWaL8fP8+G9uHr73iiqsnTmBKHuf5gv6QA44DjBWRh5hSGuYpL RbsGRJw2Dw1AEXY8pOEG84i900KXFIhLGaQu0Rkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.17 163/225] Input: cypress-sf - register a callback to disable the regulators Date: Wed, 4 May 2022 18:46:41 +0200 Message-Id: <20220504153124.529765225@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 [ Upstream commit fd0a4b39870d49ff15f6966470185409e261f20f ] When the driver fails to probe, we will get the following splat: [ 19.311970] ------------[ cut here ]------------ [ 19.312566] WARNING: CPU: 3 PID: 375 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0 [ 19.317591] RIP: 0010:_regulator_put+0x3ec/0x4e0 [ 19.328831] Call Trace: [ 19.329112] [ 19.329369] regulator_bulk_free+0x82/0xe0 [ 19.329860] devres_release_group+0x319/0x3d0 [ 19.330357] i2c_device_probe+0x766/0x940 Fix this by adding a callback that will deal with the disabling when the driver fails to probe. Signed-off-by: Zheyu Ma Link: https://lore.kernel.org/r/20220409022629.3493557-1-zheyuma97@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/keyboard/cypress-sf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/input/keyboard/cypress-sf.c b/drivers/input/keyboard/cypress-sf.c index c28996028e80..9a23eed6a4f4 100644 --- a/drivers/input/keyboard/cypress-sf.c +++ b/drivers/input/keyboard/cypress-sf.c @@ -61,6 +61,14 @@ static irqreturn_t cypress_sf_irq_handler(int irq, void *devid) return IRQ_HANDLED; } +static void cypress_sf_disable_regulators(void *arg) +{ + struct cypress_sf_data *touchkey = arg; + + regulator_bulk_disable(ARRAY_SIZE(touchkey->regulators), + touchkey->regulators); +} + static int cypress_sf_probe(struct i2c_client *client) { struct cypress_sf_data *touchkey; @@ -121,6 +129,12 @@ static int cypress_sf_probe(struct i2c_client *client) return error; } + error = devm_add_action_or_reset(&client->dev, + cypress_sf_disable_regulators, + touchkey); + if (error) + return error; + touchkey->input_dev = devm_input_allocate_device(&client->dev); if (!touchkey->input_dev) { dev_err(&client->dev, "Failed to allocate input device\n"); -- 2.35.1