Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2178642iof; Tue, 7 Jun 2022 22:19:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyojZsemoy7K1T2oQIVoOHb3S9k3VTsxe0QAZZyn9ZL3YKRELVuBIj2sPHAshU5+DT4Ue9C X-Received: by 2002:a05:6a00:1387:b0:51c:2712:7859 with SMTP id t7-20020a056a00138700b0051c27127859mr11749732pfg.38.1654665580250; Tue, 07 Jun 2022 22:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665580; cv=none; d=google.com; s=arc-20160816; b=BoJV65f5swEylKQKqnwy8kNP87ncZHJmzQWC1ohhp1PWW36NENK1ajJqkU/rMyQ+FP FhPwn9Aaj4anHlHvxAQ/6kQAiFXFnLoxoIAwTj3OJpQIRrReXfxYqPPEEoNTrJ6/H3Lp Tg8aqfx5zFe/vo+nabvbWKbBb6tPD2NxjOx7lDBA2cQh4kY4Gqs6n5c08fNZKUqgpT04 NYxUfE3PmaO4AdN58/95h1u2irFTDbXifdOR+K9nS6WStW7cqAfiPb6ZGO0sv/8E9YTm XQmeRIDxouSz/Jr8IBCCwTxfBk3toKB/qwtJWajnyFPUwNZfXyX+Jejk3sk8Ouev6xO/ Ho2A== 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=vZboaCD5oIgaKlI57MXigyla5Me8ojuDfu1q5cJjTkw=; b=l7CjrPyppqi9R+ZozWXJ+BveYoU53GO/8kIljSL1nTewTpv5aC34n6yan4bMAsU9GX H0AodhXif9V95Ufo2jqSQS1vujFVSwJzY9lFqo6XKwcyDwbnFYKLZFodmYZWMIDgl9uk IJjvDCIoquk7yJWQxkT5OCTuTCaIwPgs/qY2tgfY3a5h/ycZ/2NwgZLLH71v/zNw5MsO PfbchAgDAjMghwS+JiuiK53Vbjye0tRo9AiZehT5ykkjrzWG1ZW0Q16UGed2Pf0TyB/o f3mfsb0y+IdsMXKbA+EZlH7C9XZyOIydnlk4zJ31jUDG1Psatu4YN9BfEPLbwZzYCQxZ NY3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M0thlZnn; 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 r14-20020a63514e000000b003c6bf875c80si26787140pgl.679.2022.06.07.22.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:19:40 -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=M0thlZnn; 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 6B837226CE2; Tue, 7 Jun 2022 21:48:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350838AbiFGSO4 (ORCPT + 99 others); Tue, 7 Jun 2022 14:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348713AbiFGRxy (ORCPT ); Tue, 7 Jun 2022 13:53:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585B31447B8; Tue, 7 Jun 2022 10:39:47 -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 CC843615F5; Tue, 7 Jun 2022 17:39:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B25E7C385A5; Tue, 7 Jun 2022 17:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623552; bh=5YfO6wYxuI36GuaW0/gD8NPiHcmgmSRqF/dYT+hzzsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M0thlZnn2GL2r8Sl+Q38fQyvPRNes+8+NBBW8ohJO03/zy0PxlpSq/AskQsMvxmDa /tlKBixFmgV0cEnAT7hF8Dv9Z2h1qbFgKL+dW75WohJ7aZCOLZo51XMOtKJwsOPSo7 NqRqgxFv+k/dIYMua9UmeexEgD/U42sufV5Sjc9U= 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.10 427/452] phy: qcom-qmp: fix reset-controller leak on probe errors Date: Tue, 7 Jun 2022 19:04:44 +0200 Message-Id: <20220607164921.279200824@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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 @@ -3717,6 +3717,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) @@ -3811,6 +3816,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)