Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp319313lqt; Thu, 6 Jun 2024 04:53:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVs8hGg6+Qc3MXAGL7KGOVQPg57M1Nyxo5LsbrTKhNZ72MoX2CFklH19+nokQ+sw2KjkUNZwdkxJHSaec2Am/YmUH9mZ5tItcH30DW3jQ== X-Google-Smtp-Source: AGHT+IGRgTh8Kczv/PFwgixxbVqNZt2lvbR7X/fE6YHvxffr9k+nySxfBCQLCHGSB9vU1YW0qVCl X-Received: by 2002:a17:90b:2292:b0:2c2:4106:21fe with SMTP id 98e67ed59e1d1-2c27db1039bmr4735623a91.17.1717674791929; Thu, 06 Jun 2024 04:53:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717674791; cv=pass; d=google.com; s=arc-20160816; b=wEISzjUmIR+Cw5tlaFuYkAuvs/hglqBAhbNoYqYk0GMjmkLAkyngm/RfobtklKgTH+ RuSpBOHrXucEeO15qjoLKu/Mr9gw3J311icLvzjNZTEBT4T87sMHbWOduCd11dncbuCa BSPDwHohUnCC0HlhVGAQNiUiPieHB+6GZpej2QyD0fqpKQs8CSinoyx7iXOjN54XeKiQ DVfWJ27YZhKHYxWvTuXCE8GDmybVmvN6TPegVsgfcfbCwqeyhLKnlKF7FZQIg9xCS+ZU TzKaKqBddS9HHyXPdS7X3PS4NUAY408oeW/Oz466s2ZTvhrNq8OA+LQaAF00lN/LUiZZ WbWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vmCG0HdrVkqDbsd7U46gYU6Xd1wADbgM1SQasN2fUr4=; fh=PHa/kW5NeM4gs6Z2ZQGf9+wLHr4z9A0GRrerG+xjBE0=; b=pDphsf0UmtDZqXM8s80XnUsblYI91zda60arI/T7JmAqjTQSSSPnPATM4Im/eT7Xp8 /brnzE6Rn5t0lJnvcfVzq6lALTBsLnnx4/x3dUC8UFDztjeJ7DdjBxZS5SS2Gf4qly/N mzEsPCVvlDMxaRZEaqrtFVj04/yYD/vlGqe5i3NJ6C1u2eeH4RnsZukejMikYoiM2Yjx xZ0AEEtLVNBm1xzgasZ1IL4Jg7pxWjPv/kgrQzrFozaNz0k+NVF27uqyZwMhP4ys/PT8 ftMNB8ac0L6OnBmTR7yAEzNTuEXoY2xFeW/G9sXiSrL3o1b8CyGecCgPp3hwvPbOTgqI oQVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nyeVwCmT; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-203761-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203761-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c2806bd667si2861839a91.98.2024.06.06.04.53.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 04:53:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203761-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nyeVwCmT; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-203761-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203761-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C4628B2336F for ; Thu, 6 Jun 2024 07:51:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07C4C13BACD; Thu, 6 Jun 2024 07:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nyeVwCmT" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4E87DF44; Thu, 6 Jun 2024 07:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717660257; cv=none; b=e1nbRokBa8zqkmBnR9amfITeACUVt0VxtWT7kWfp08oh90ZGoXf8xXc4eS6Jt76F4cAdtVS7rGocV4yr/MPw3cQInOmJAiWvxMRLTtzM927uxfyJjsTK4uU18GEefxobmHs1UzPaCocPZlf9MO2dfYNd0qzLMNGJD6aKV10P3WA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717660257; c=relaxed/simple; bh=KbKt7/g1FIVQl+e686tRBTUARQfsnnzl+KTMOBV11GM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZdaJo0rsWxypvuEA25xXok6V4FLO/vqYGYum4DpHK2FAuMURMlGjiqa2FKnzqIUz3lRlqM4LH8Z80NUem8Hqbyx0+7ibamlaAMfr94z6VdVRh8V3B72qt2+LAK/WEupr9UZuvWK9lqAM6POgtfZwojb8C3lwIQI2q67y3Be+V1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nyeVwCmT; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717660255; x=1749196255; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=KbKt7/g1FIVQl+e686tRBTUARQfsnnzl+KTMOBV11GM=; b=nyeVwCmTjzY0f6CllUF0rka7wDHi0PFxX+GZ1HsU3uhsQtYxq0jRh/sD oJehUKPWY5NolNaB2wJhTlN+t7fg00FL2LUFatKQQgkDxRFqR5rgMwqwc O9Vw8Mdzd8rz6km6E05x+7+BXm9SL7N3EDeGbOTsibGkfyyyBUW5URhiK jcOEaKGxEpOzLK0jaqQEkRf46Rjjay8EfBmXoXThs6WLpOyeiiiR2RuKS q+XCAOIbvMsgXeMU61R+JPAYyGMpLfKPatvdCqDw5ejQ5OekH2JnY7tAk RjIVe6IICxUoXHkAqpMomaBSeFxYo+5l7QUBX2ZJnwcg2ju+gvA6yj0tX A==; X-CSE-ConnectionGUID: r98B2grqSAeSE+FQGgQUEw== X-CSE-MsgGUID: 9SbnLWjgRDyH9kCt/JUkTA== X-IronPort-AV: E=McAfee;i="6600,9927,11094"; a="24966544" X-IronPort-AV: E=Sophos;i="6.08,218,1712646000"; d="scan'208";a="24966544" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 00:50:55 -0700 X-CSE-ConnectionGUID: ASUIEKgwTyCLrIwxWuK8sg== X-CSE-MsgGUID: aRNYetmaRNa8KejmhwBAJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,218,1712646000"; d="scan'208";a="68689466" Received: from kuha.fi.intel.com ([10.237.72.185]) by orviesa002.jf.intel.com with SMTP; 06 Jun 2024 00:50:52 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 06 Jun 2024 10:50:51 +0300 Date: Thu, 6 Jun 2024 10:50:51 +0300 From: Heikki Krogerus To: Markus Elfring Cc: linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org, Greg Kroah-Hartman , Xin Ji , LKML , Jonathan Cameron Subject: Re: [PATCH] usb: typec: anx7411: Use scope-based resource management in anx7411_typec_port_probe() Message-ID: References: <889729ac-3fc5-4666-b9f5-ce6e588a341a@web.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <889729ac-3fc5-4666-b9f5-ce6e588a341a@web.de> On Wed, Jun 05, 2024 at 07:11:04PM +0200, Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 5 Jun 2024 18:56:19 +0200 > > Scope-based resource management became supported also for another > programming interface by contributions of Jonathan Cameron on 2024-02-17. > See also the commit 59ed5e2d505bf5f9b4af64d0021cd0c96aec1f7c ("device > property: Add cleanup.h based fwnode_handle_put() scope based cleanup."). > > * Thus use the attribute “__free(fwnode_handle)”. > > * Reduce the scope for the local variable “fwnode”. > > Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support") > Signed-off-by: Markus Elfring Was the fwnode leaked, or why else is this a "fix"? It's not clear from the commit message. In any case: Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/anx7411.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c > index b12a07edc71b..9fb52f233a30 100644 > --- a/drivers/usb/typec/anx7411.c > +++ b/drivers/usb/typec/anx7411.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1142,11 +1143,11 @@ static int anx7411_typec_port_probe(struct anx7411_data *ctx, > { > struct typec_capability *cap = &ctx->typec.caps; > struct typec_params *typecp = &ctx->typec; > - struct fwnode_handle *fwnode; > const char *buf; > int ret, i; > > - fwnode = device_get_named_child_node(dev, "connector"); > + struct fwnode_handle *fwnode __free(fwnode_handle) > + = device_get_named_child_node(dev, "connector"); > if (!fwnode) > return -EINVAL; > > @@ -1237,7 +1238,7 @@ static int anx7411_typec_port_probe(struct anx7411_data *ctx, > typecp->caps_flags |= HAS_SINK_WATT; > } > > - cap->fwnode = fwnode; > + cap->fwnode = no_free_ptr(fwnode); > > ctx->typec.role_sw = usb_role_switch_get(dev); > if (IS_ERR(ctx->typec.role_sw)) { > -- > 2.45.1 -- heikki