Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp630680pxj; Tue, 18 May 2021 10:36:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQYXRQLuXRddGhEUQT+K/rjbRxV1nJzVnphxIl+wYuD17KRbjMV3I6hFir24YdZXyD4COv X-Received: by 2002:a05:6402:520a:: with SMTP id s10mr8445956edd.245.1621359360295; Tue, 18 May 2021 10:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621359360; cv=none; d=google.com; s=arc-20160816; b=VtjWLUHA+K6jT2v80xzZX0nuo5YsZSkKaE9q46tIoz9M4BGB8OhY4yzxVxl43/8m+S Jgi7fpgsCIRJKoOpSw7+nqgNb7FFXQ0EKKp5392Ln1VIGZoZj0VSBIUViDB7IZFqJqsP 4KN/mrVH+1TD6zUQBjLuSDzpjizyM3wvdnm0ytrt13SdJkWiYsaPzVwZlxNCXMwgY8WA futJl+0QBLjzvHO5P5XFw9H+v9LUBFndvo+/TcsILxtOBt9SXUw81iTl21UC0WXedl3r pWVhVHJ+kFBk1jzYlX6ZtQxlGIixoKl/buAItUHuUunA7CMXsYGlJAe4H+iclhaApWmT v1Tw== 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=cHuGLoh4dZMyrEJXtq+5y1mgaGel7DLuE1UPIgm/BJg=; b=tOecAICeOHtPvEZwPNHXiNhGcHzu4Mj3kjVxMgSI8Q80jIpSmvtWe9Jt6oYbJ7Z2Lc W9s+vfABr9Gp9emOYgXYWEZG6OtX6/tqAU1egMfnRWTcN3OkUZD6tlXUoTvfcdzYa2ls dtZQK5pt+Z1MOFQRIkCBAmpAEbyWyTaFyTnWtqA+l4dhpOc0sFEiiDCbHT1krKPWbQFf ZMhBPxw4vq7YBHIGsENBahQyqx9Pq8F9iSZE1+H5JmboXS40JeR+xan6XPsK9qY5TIds 4zdnVo3X3Nigo1cT+ZQxd0JCI95vBltlpnkP1ISm4t6TCZRn0q3BGeJ7ndj8K3u5hndk aRWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qDOd3RbO; 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 s13si18595581edr.539.2021.05.18.10.35.29; Tue, 18 May 2021 10:36:00 -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=qDOd3RbO; 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 S1346739AbhEQQJo (ORCPT + 99 others); Mon, 17 May 2021 12:09:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345021AbhEQPqN (ORCPT ); Mon, 17 May 2021 11:46:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B37761954; Mon, 17 May 2021 14:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262654; bh=9e1NpktBaQxCEzNSTtXQpzNt52VY3DIH7mIJyie7GNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDOd3RbObhw6fleigVvLX3k9IPgFj/1z1XPO10uGDPjIEuc5rsgy3hx9B1R3zodHe OO7+TeXQShYgW9HYMrePqLy7NrE6CekwTpvamTOLS1lK63E4BQUjPpeVz2ap1s1I5S R+rb239tuly/1tOc+1wbv0R7LR2JFrqqNy/P1iZI= 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.10 248/289] usb: typec: ucsi: Put fwnode in any case during ->probe() Date: Mon, 17 May 2021 16:02:53 +0200 Message-Id: <20210517140313.493562254@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 @@ -910,6 +910,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; @@ -943,7 +944,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; @@ -1039,6 +1040,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; }