Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp151537pxj; Mon, 17 May 2021 23:39:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3KpiThN9Q3G209JM2ducf3qny2uMqUo2i895h5/w/ztVfiv+nyzGUjGnE2TybkQhN0fPT X-Received: by 2002:a05:6e02:104b:: with SMTP id p11mr3035375ilj.275.1621319977884; Mon, 17 May 2021 23:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319977; cv=none; d=google.com; s=arc-20160816; b=rbK+DUeuDsi63SNNsW0K0y6T6dEu1XtLs5ybMLOepNGHmg78Yt8nCmlnjCTaYTNAxO BI13rhYKsbArbKh/bu+ifm0p7IsVae3WgzFERGWwdjN1x4OCNtjz5j0pGMhFPbQSe6U0 u1r/P7ph6GPj+ckkBjv60glMBnSLIY4m2+NSEhe8CZ9VRJD6FwCK23qvaPWdYiGioPAE XZWlaYfsoYVv0Wkh6FQaBOwv056hcXRc5yrR9XnU8vzf4emq2fgoC1ns2PFNYW9atvAP 48GZlLnKAyNoaDgvYMYo4bcIugu6ae9zo1OeHrVWtLvIrOrQau/yV06DunVU9261kTDr g8lg== 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=/9qgDyQ1Ucsnvdpa1QYObjmhtnugxTPkQiKSV2sDNhs=; b=JHmiQK5l+SOHVrQQYkXVjSH6wBhyWfOHlHFVmVLamukRV3JBuv79lQt1zi2uVccrL9 sGVGUnbnoPbS8kRNxptjfpHDm/62l+/nDG7o44E6YbpHV9OS28uv4swnrYFj2Z9HQeLL ffZlbSQGVaj7K+GkFXQQat9rB2F6IAOicTfgjbvNvP6oe1UuLbqvUW1LDZkaUlDyVwrQ Qz15NTsKRdcWBTwZQt0IfoRPu3LasUXrefjHjzgNPPsO2af+xnu7dyYjUwoGdbu4diYG d42SHjjTAnN3ZrsCDp+9OWupuqITnWe+xF3H+qA7GwP7VDR4+WkwQs8/D2O/dGAyDCb7 rmBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0oZb6AZI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si21511211jak.13.2021.05.17.23.39.11; Mon, 17 May 2021 23:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0oZb6AZI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239794AbhEQOu2 (ORCPT + 99 others); Mon, 17 May 2021 10:50:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:56784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241161AbhEQOmQ (ORCPT ); Mon, 17 May 2021 10:42:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 612CC6135D; Mon, 17 May 2021 14:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261176; bh=rTBkofXYKbgQNT7eXY64MgYEMpAKwloy9w5qfSIvRyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0oZb6AZIAGdXms2pIUSyQ9AwtudGalGeGTCOdJIleVFWVu0CEPLz475LhE5FZGmhG b8s0RuUf+c+QDjfTco6InSPkL2Mg5HI/NUl5mJ3X9f1zvFRvD5gzIZqks35PosLWno vcDIsBJ2VzkxpjH7ut3f+6aatyCYYKnHCNzyiptc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Andy Shevchenko Subject: [PATCH 5.12 318/363] usb: typec: ucsi: Put fwnode in any case during ->probe() Date: Mon, 17 May 2021 16:03:04 +0200 Message-Id: <20210517140313.359761361@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit b9a0866a5bdf6a4643a52872ada6be6184c6f4f2 upstream. device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface") Cc: Heikki Krogerus Reviewed-by: Heikki Krogerus Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210504222337.3151726-1-andy.shevchenko@gmail.com Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1022,6 +1022,7 @@ static const struct typec_operations ucs .pr_set = ucsi_pr_swap }; +/* Caller must call fwnode_handle_put() after use */ static struct fwnode_handle *ucsi_find_fwnode(struct ucsi_connector *con) { struct fwnode_handle *fwnode; @@ -1056,7 +1057,7 @@ static int ucsi_register_port(struct ucs command |= UCSI_CONNECTOR_NUMBER(con->num); ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap)); if (ret < 0) - goto out; + goto out_unlock; if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP) cap->data = TYPEC_PORT_DRD; @@ -1174,6 +1175,8 @@ static int ucsi_register_port(struct ucs trace_ucsi_register_port(con->num, &con->status); out: + fwnode_handle_put(cap->fwnode); +out_unlock: mutex_unlock(&con->lock); return ret; }