Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2195952iof; Tue, 7 Jun 2022 22:52:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr031umkknFLkoYa/7uTwzb6Ibdt5U6oIHnKj/PwOamsOa06zwvB4E/tDdMmVJnFH8n/tq X-Received: by 2002:a62:544:0:b0:51b:a90d:64d3 with SMTP id 65-20020a620544000000b0051ba90d64d3mr33133566pff.40.1654667578221; Tue, 07 Jun 2022 22:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667578; cv=none; d=google.com; s=arc-20160816; b=UEHFG7TxkA6oaYq18Kn8CXAvx9Vj9rnKOCGRJXBtQ+aUDRH+V49r9t65kq6jJ8FbO6 RpYTJI3Nir1lqnzcAdf5mPSp8Tg8qGQ2osEmPCHhbt258f+aqbctBQnrV1JWyBTx8PxW 172Yy4IG4qxVSPDYh7oD3z5IflCTgc6H0w9yXsdvgMnnHHuzF6afMo1z74eTraTdENCN Iwur3yEGwHcO2Qq32KORFzhHyNMK2/t8QXmVrXh/W98CQTzAVygUxbT2JYH8rsP2Qn7D MmyZDLRevEd1Zs8Kry5+pJrWWL63jc8eOMr1IulHXc70uYmW9g416XXGoAThbA7UlwGO +YRQ== 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=T/lkoNhRQbKGqa5KazV58xU6J0zWQZFclB4/jVZ+WDc=; b=e/lekn4B0mFS1NqXkVz3EcE88AJk/Fk6n84m3s5kJ8jmDeL5T0EM9ndHI4tnTYgkOG XEZcP1NFBGxOWZBi7n3G9b81LYqK+PaDtmWn20AogPvkUzP22Cw4b9y5qnQk5b5U3k20 3Uxk6taHmXu16DzwCLR6HQ933xkHhcncDwttgk5dgBp0cv5j0bKbg5DcNGgjekgkGz2Y PxxDO2hXpZRLCAAuhgwaAjQsWpUhLZ0geEFINrhd5c5Nhu2sI5sw7t++yzSD0pJTKoLq s3cHmNgqg2EndWcNAm0FakV3O46khl0oKvNmeOogzUkhdK20mmEegT8daEE2SVHTK2yU oR/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D8XWBXFr; 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=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x70-20020a638649000000b003fda873647esi11980039pgd.737.2022.06.07.22.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:52:58 -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=@linuxfoundation.org header.s=korg header.b=D8XWBXFr; 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=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90D7B40CF8A; Tue, 7 Jun 2022 22:19:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442061AbiFHAxt (ORCPT + 99 others); Tue, 7 Jun 2022 20:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385618AbiFGWbk (ORCPT ); Tue, 7 Jun 2022 18:31:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 558B927B4B3; Tue, 7 Jun 2022 12:25:06 -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 51A42611D3; Tue, 7 Jun 2022 19:25:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7A7C385A2; Tue, 7 Jun 2022 19:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629904; bh=yuf6SWhWS/sMDh8rY4efQMgGvK9sSH5Gqeiij2RoHc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8XWBXFrUEi3w579EhRaFq/ZlduWLful3bQox5zon0bZnlwoOpjV9kUVTRBV/KhWJ WXj4L1m9H6awvwfCTSEaUA42KlF8Qtt6MOCOct8W0hxxDdzwRJC2/vsFTZKubygU1p V4YTslulwFkAsagcgTbPF5zZNJiQw1DMnKy+hnqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vivek Gautam , Philipp Zabel , Johan Hovold , Bjorn Andersson , Vinod Koul Subject: [PATCH 5.18 860/879] phy: qcom-qmp: fix reset-controller leak on probe errors Date: Tue, 7 Jun 2022 19:06:18 +0200 Message-Id: <20220607165027.817469026@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 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: Johan Hovold commit 4d2900f20edfe541f75756a00deeb2ffe7c66bc1 upstream. 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 "lane" child nodes, devm_reset_control_get_exclusive() cannot be used directly. Fixes: e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets") Cc: stable@vger.kernel.org # 4.12 Cc: Vivek Gautam Reviewed-by: Philipp Zabel Signed-off-by: Johan Hovold Reviewed-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220427063243.32576-3-johan+linaro@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/phy/qualcomm/phy-qcom-qmp.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -5818,6 +5818,11 @@ static const struct phy_ops qcom_qmp_pci .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) @@ -5912,6 +5917,10 @@ int qcom_qmp_phy_create(struct device *d 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)