Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp892692pxb; Fri, 22 Apr 2022 13:36:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRSQ2OeTDlGCv/s5PNtjVwAzLRzKf46DG1F63H9YFxqi4DJkJed2GbkQ+2uhxNXE0p9ySe X-Received: by 2002:a17:902:e552:b0:156:9cdc:e6cf with SMTP id n18-20020a170902e55200b001569cdce6cfmr6366940plf.78.1650659798201; Fri, 22 Apr 2022 13:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650659798; cv=none; d=google.com; s=arc-20160816; b=ZOO8x0f5dXOYWNfPD8qGnBN6LIIns+nT0cw00XQ+ryGoT4gsFyBctpNF+2FORyxBfv MCGjeJuQjGGpqat93UpT3XhQwh0UII55YQ8C8Byr2qa/FQZPsgJDEbNZb5YhdhLw01v9 cPU0wmXMnnG7vYQl3Tf8TPLR13jUbHIyDZYbrBbfHX68pN7wqPVbeaBM2uA3Da85FbqN ib3ZKiWSeisWuPbcfRhps3XviFwS7ia6rG99TndFq0nUFZSMMqTRTcdF6ZdpAjklXJ5S 27O6yrdQ0WEfEECbFkhulAuUTK9Ek0rwGwfsjLlTofc+0N/+bB35I+2+D/GTKTZCuHLf FufQ== 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=c/UyG1jm2KeFrzA7PJY/VQisj5ECl2kkSHEFPXdIL8o=; b=gEGC9eP2tXE1m5NI83jIELt+fH7z93aPLaWBVnT0qRk6QL7fc/8W97nw0xBPGIa9nW wZ2Ib6mAmomn1GCifZ+jbMxofUY73/3yzIyYzsJmaU7QZNOT64IkMlzxe47E54sDhG5T DccsIL5ttRoZaVmWXBn12YH1k5tyKsKW+ZtIpUHtV85anR7rKEIP4k4E47vQqOVbUmEt masNTfhUFj3N/LWC3LuQW28cBVvNxOG1M6hKVWceCkDg2QBfW0IrJhN0VUtfRf6OK3Rw 7fraRJxU85QeBJnR3tw8CqpEc0ythQ+XqbUGmPx9MrmtH1FCitS50I+GYl04Q+f567dz mrkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BmSnXLbv; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o21-20020a056a0015d500b00508372bac17si9948964pfu.305.2022.04.22.13.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:36:38 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BmSnXLbv; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D23F929CBF0; Fri, 22 Apr 2022 12:22:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233857AbiDVNNK (ORCPT + 99 others); Fri, 22 Apr 2022 09:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234055AbiDVNNE (ORCPT ); Fri, 22 Apr 2022 09:13:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111D211C2E; Fri, 22 Apr 2022 06:10:11 -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 sin.source.kernel.org (Postfix) with ESMTPS id 7A493CE28CB; Fri, 22 Apr 2022 13:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B01EDC385A4; Fri, 22 Apr 2022 13:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650633007; bh=g3alPqst2KMNlYTZRbC5XyNbsp+KF7ToOB5E/iahWmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmSnXLbv3bCIK14FIUrfQg+LE4M2bHWoHYa9H5zEJcvaC8xjRJYEqpFnkS92TYhvt z8z3fM4w26I8XDJWLs18DuEjXHRNf2LKIU79t5JHYj437CsZ+2RCU/YS5bKZ/U8FL5 +LY0Pd/WMQNNDFJoqWeR/149jWXk/7tULcD+nZTLJAaYQwtKe+RW7aPPoPg27wx2sy /pBl9AMACJdoiJSrFX6FxjSkqkBJlvH9uq+LMigFee4cDL9XVCPSaIQagqASs6YySH YP3qmqsAkdcA1fAXt49VzNTIAbo4pAj5CPWXEzZEFqZve6y3PliQpM42sHEkEn9xE8 0eDbveaIAAmpA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1nht2w-0000XO-5m; Fri, 22 Apr 2022 15:10:02 +0200 From: Johan Hovold To: Kishon Vijay Abraham I , Vinod Koul Cc: Andy Gross , Bjorn Andersson , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Vivek Gautam Subject: [PATCH 2/2] phy: qcom-qmp: fix reset-controller leak on probe errors Date: Fri, 22 Apr 2022 15:09:41 +0200 Message-Id: <20220422130941.2044-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220422130941.2044-1-johan+linaro@kernel.org> References: <20220422130941.2044-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE 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 Make sure to release the lane reset controller in case of a late probe error (e.g. probe deferral). Note that due to the reset controller being defined in devicetree in (questionable) "lane" child nodes, devm_reset_control_get_exclusive() cannot be used (and we shouldn't add devres helpers for the legacy reset controller API). Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Cc: stable@vger.kernel.org # 4.12 Cc: Vivek Gautam Signed-off-by: Johan Hovold --- drivers/phy/qualcomm/phy-qcom-qmp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index a84f7d1fc9b7..3f77830921f5 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -6005,6 +6005,11 @@ static const struct phy_ops qcom_qmp_pcie_ufs_ops = { .owner = THIS_MODULE, }; +static void qcom_qmp_reset_control_put(void *data) +{ + reset_control_put(data); +} + static int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id, void __iomem *serdes, const struct qmp_phy_cfg *cfg) @@ -6099,6 +6104,10 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id, dev_err(dev, "failed to get lane%d reset\n", id); return PTR_ERR(qphy->lane_rst); } + ret = devm_add_action_or_reset(dev, qcom_qmp_reset_control_put, + qphy->lane_rst); + if (ret) + return ret; } if (cfg->type == PHY_TYPE_UFS || cfg->type == PHY_TYPE_PCIE) -- 2.35.1