Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3120280pxj; Mon, 7 Jun 2021 02:51:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw718QbV18HxW1d7Jzsp7qzwwW98lo41xrxpSbfl5paxuN9kUYf9eDJTFlAik7QIHzMWfmw X-Received: by 2002:a17:906:ae92:: with SMTP id md18mr17191875ejb.410.1623059468049; Mon, 07 Jun 2021 02:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623059468; cv=none; d=google.com; s=arc-20160816; b=O7v32AdIs/DdocDS6B3YJA9eqeqrtMFwQ0N1BICybkGNmtR06Kdpvw8KKiF0Gh9n2Y vpMA+CyLt7JL31atSH+BQ14eXCQKYcg+9vo0T9K9r8ASkzyxyj/0l3dPpp2WKT9XhBA+ vCLPRpBfzttSCua9NmhkYwo0BA6XZA9Uat1mCOBNVbDPqKNyYxWSA+jf0Z1F5KdOpN2x +IORYpgWrdOk8fgxUU4G08DJEPI6OsU+7ph1861qYk869SgVCNERT5oVtNF1/YxjrOJc yazr97QkeoZYQV1Ize5doAvp8+tyZYYmDn0JnYVZsEFR2L7kKCmBFpECdHpIZdmVD+ME Ncrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=da39wnRuzjhHZZgQlY6dNSIdHaYbQ3U15OAjFIb44nY=; b=EHDe7auJeAy5Wn71S2IF510XwEhcufqD8WAD8nLVC1ddExMj2zUfVZ+2MXSxiCDimu +3KGJ4eapSN8Yzzv6pbajgPAEdsbESZSVPET+Op01mzd/17D2l0Ls3MeFUgBX5PIWAM3 YRbtDfB42/mKQ4+PNq3EuwBdnR32A/d/vuwoor/X+xbdOtJ3OoBAZWuQR4Cys/a8T5LY pE5+EcebmuiE9lAlX/CmVp3cW6BuVyjG2P6kyXyvw6RCOQkulZCZ3/Sv/ijwQ7Fpf1CT Bn/8vsOIP44LbJPqwa+M6LYEeyyqsL7I4Co51HEqu4+v1j14WZx/8Blb2wMTgx7oCzRV tF6g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk7si11739683ejb.409.2021.06.07.02.50.45; Mon, 07 Jun 2021 02:51:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbhFGJvA (ORCPT + 99 others); Mon, 7 Jun 2021 05:51:00 -0400 Received: from mga02.intel.com ([134.134.136.20]:25209 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbhFGJu7 (ORCPT ); Mon, 7 Jun 2021 05:50:59 -0400 IronPort-SDR: Ns6ajJIjS0FFDZaLfcF5xdKHdkP5VqmaAhkrn/vwlPq+9f+x+ouCFkQQDGkp8aYI4+PzQjnUte iXGAHVBLey+w== X-IronPort-AV: E=McAfee;i="6200,9189,10007"; a="191701338" X-IronPort-AV: E=Sophos;i="5.83,254,1616482800"; d="scan'208";a="191701338" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2021 02:49:08 -0700 IronPort-SDR: /DDeSmzHEeVlnfExAoUBsyqug8slfVvyhlHy+ZS3qofr5uZ25vujAuZDMufEdUxYz3dQSfW2S2 G79u34FBygQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,254,1616482800"; d="scan'208";a="551822369" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 07 Jun 2021 02:49:06 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 07 Jun 2021 12:49:05 +0300 Date: Mon, 7 Jun 2021 12:49:05 +0300 From: Heikki Krogerus To: Andy Shevchenko Cc: Greg Kroah-Hartman , USB , Linux Kernel Mailing List Subject: Re: [PATCH v1 1/3] usb: typec: intel_pmc_mux: Put fwnode in error case during ->probe() Message-ID: References: <20210606200911.32076-1-andy.shevchenko@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 12:29:53PM +0300, Andy Shevchenko wrote: > On Mon, Jun 7, 2021 at 12:23 PM Heikki Krogerus > wrote: > > On Sun, Jun 06, 2021 at 11:09:09PM +0300, Andy Shevchenko wrote: > > > device_get_next_child_node() bumps a reference counting of a returned variable. > > ... > > > > err_remove_ports: > > > + fwnode_handle_put(fwnode); > > > > Wouldn't it be more clear to do that in the condition that jumps to > > this lable? > > In this case it doesn't matter. As a general pattern, no, because this > will help to keep this in mind in complex error handling ladders. That > said, I prefer my variant unless there is a strong opinion to move it > into the conditional. Now it looks like you are releasing the mux device fwnode instead of a port fwnode because everything else related to the ports is destroyed in below loop. That's too confusing. Just handle it inside the condition, and the whole thing becomes clear. > > > for (i = 0; i < pmc->num_ports; i++) { > > > typec_switch_unregister(pmc->port[i].typec_sw); > > > typec_mux_unregister(pmc->port[i].typec_mux); -- heikki