From patchwork Tue May 2 10:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 89310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp507328vqo; Tue, 2 May 2023 03:43:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CBs8XW/gnGV3+CcfsYa+LJUGQFgUw9kLQiYMz1flboMTkvcYaK3mobxJp2YuyxZzlgCkd X-Received: by 2002:a05:6a00:22d3:b0:63b:89a2:d624 with SMTP id f19-20020a056a0022d300b0063b89a2d624mr26553496pfj.12.1683024212478; Tue, 02 May 2023 03:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683024212; cv=none; d=google.com; s=arc-20160816; b=GQ2piRSpxEZ7Rh9kq97WegHdHpRbCwNYRXlrM8/7hUsGP5/LHzYTI90IAhykfGW4Wd y6qvtVHQWPHSBKMSCQimKRq/AL9gTvFIW/0U3lLojbT4rJ1oagjMg9RHqi8unwlPi517 Obh9v+ZafEQORJfuxkM5d3cJMR1C2w6GUoWgu50rGowRUwey5z/70+sGf6JlLCfL1MGa 5U0MaC4tPr14k1og8nDVGUvUmoSbUum0Aqk95DRv/6vUZptHbUN87bmfwwNRqe1JgXif Coy6k79DY8Sc5CNOv+Q+muysidsUkLEr0bxlT++BzzoSQGffeHKST2L7zen8DseffV8+ HXkA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TGMknm/fMrvtKuBTd2KO4X9bC08BJdQ7XdK0xAyjYTk=; b=o59VuA61+4kwE+mvHdT2hN3NXNwDzve26gzN6zyXMQJTxLcbyzedEF3uBngCrDqyau gJ50GyyaV5k4M+IZcd0m6JGkkaYJG8dQml7l8GpcgUP0XldBhr/7Gnh0oSVippCKUgHg fUSEFlOPuMD5h8N1xOZ6HlzUSvZtI1VRUNd6q70GzZ9EF8FHBDrquVy0VS8Hn8WXxvbl Vnw7dKQrRftWBgYWAQmrgJ8unNTIAfrrbBu/tsKWyzJbJryJVZFNakKjx6PQC3RVos3C lEeQs+aFPveW+3WOYJ4tpaxjwr+H9uH9VfEuE3Ce9NdYmALbrHOhWWURBUfD0FUwLRQX cAww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RnvNWesz; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020aa79536000000b0063b7790fde1si29669974pfp.284.2023.05.02.03.43.19; Tue, 02 May 2023 03:43:32 -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=@kernel.org header.s=k20201202 header.b=RnvNWesz; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233964AbjEBKjk (ORCPT + 99 others); Tue, 2 May 2023 06:39:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234038AbjEBKjM (ORCPT ); Tue, 2 May 2023 06:39:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F61B4C0E; Tue, 2 May 2023 03:38:51 -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 1BA0F622BE; Tue, 2 May 2023 10:38:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EA69C433D2; Tue, 2 May 2023 10:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683023930; bh=wFErpi5cswaNrmCHXUKcLKuE14JY4SYvJDJ1O2W7YCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RnvNWesz5byE6Wv0rjtyrWor3M4fsdZCmx4Ou0ssG2rdCcDrLp711q14htRAbHfqS R943ikJPOEifUGbUtiGarnZYjWHqWPWkc3UehJQiO22X/MWPrCc4DTd7Kj7brvBDHt QqscPql7hFkA42CIGLA+aIzbxRz3g/n5X47/ZOZro1p8R+1FHXLkP6Mi6Y2w6yoJf4 35zvTt8H2i0l1Dnj2MyBFLtoldaPmqmfWBzf4e4Gg7ln71v+e4hO9Qq+kmSnj/sEKh hr7A5McDhIzR9uf5nIFHUiolSKQHU8sFERnUFGjuhbNjgtu5qY1909AeQM5bnYiS8O kkI8UcGLywTtg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ptnPJ-00038x-3w; Tue, 02 May 2023 12:38:53 +0200 From: Johan Hovold To: Vinod Koul , Kishon Vijay Abraham I Cc: Bjorn Andersson , Andy Gross , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/2] phy: qcom-qmp-combo: fix init-count imbalance Date: Tue, 2 May 2023 12:38:09 +0200 Message-Id: <20230502103810.12061-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230502103810.12061-1-johan+linaro@kernel.org> References: <20230502103810.12061-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764778796171467916?= X-GMAIL-MSGID: =?utf-8?q?1764778796171467916?= The init counter is not decremented on initialisation errors, which prevents retrying initialisation and can lead to the runtime suspend callback attempting to disable resources that have never been enabled. Add the missing decrement on initialisation errors so that the counter reflects the state of the device. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Cc: stable@vger.kernel.org # 4.12 Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index c1483e157af4..ae412d64b426 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -2487,7 +2487,7 @@ static int qmp_combo_com_init(struct qmp_combo *qmp) ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); if (ret) { dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret); - goto err_unlock; + goto err_decrement_count; } ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets); @@ -2537,7 +2537,8 @@ static int qmp_combo_com_init(struct qmp_combo *qmp) reset_control_bulk_assert(cfg->num_resets, qmp->resets); err_disable_regulators: regulator_bulk_disable(cfg->num_vregs, qmp->vregs); -err_unlock: +err_decrement_count: + qmp->init_count--; mutex_unlock(&qmp->phy_mutex); return ret;