From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C48D23759 for ; Thu, 2 May 2024 07:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714633543; cv=none; b=PkPorhx0GJKBNdzhHa8SxXhYuUsXG7pRa2u49F8fkVTWuw+RaVwCTOGdDtVLtsUrZoj7t7vAURgdhOyNwYMTKW1voMYewlrmzV5/XhxTtFahK0lGQXvSr1gr5JEIpOmnfUWHUDJtNhdPc80b3C00EO1TPUVDfZJa68GnxJ7hTsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714633543; c=relaxed/simple; bh=jmCz2bzZzN6llSSfnEw77N01jtx9utNXMW5o87pvL2I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rbzNZJWFAXXq3Yp5gxe+XLX/nQuUQl7qftPawRLZN5AoR12vmIXvCrER/GbrZvt1B3M9S9On5QAh+3f+DS2YjJzDbfYoCY35jlDw0uRtYIEknCtyLvwAtZO39H9Xeh7UhD7cIBl6HbmTP6ShcD5OXZNXvyh1muehXQEhonIBLWs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=zOqxvveo; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zOqxvveo" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2df9af57b5eso73699601fa.2 for ; Thu, 02 May 2024 00:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714633540; x=1715238340; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=V3T3S0/ACanJIeY4czsTT+RTZ1YRol9ljsewIaXQads=; b=zOqxvveoh0antj8BAs4hQvuiDTYMLbFX6Gto+PdQ7hl2MT62tfWZ1Q4ZYhaHtnVVxK VVpIqua7oEgqKx3G5v7d2vMuiLxkb0DlfBC3p4BM6nOdVMlUsIaa+kTJlCIs9k+ewaLj +KokrfVL9ldJ+4TJr2CkZZCuYk3e+4dtfQqK8vXBnTStehYk9i28w8+//9db1Hjq3xR6 odXInKjwg/237Fd3XORDBm98Y/J3mpbj05871x7CBdGrlMSDjRiYB3JQ9i41PFCs1hPh AOXbZsuPil/A2+4TO+/4QX3QT9lTJoewkZtR+VgILuC75Jwk89aEQyUtsGgAp75ZxmWa wVJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714633540; x=1715238340; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=V3T3S0/ACanJIeY4czsTT+RTZ1YRol9ljsewIaXQads=; b=UBHcbdaCB7D3TwmLvd9bWrzrXTRl7f4Y5xJ4Fya621Wt1QPSm86g9dXYkevKgm8tlV VOXHVwJJ+5gyLnoLVVB7FAtwH5FRkxbFgDSwG7MW79621KBmiJDE58kL/ojYbSNgCCk+ 4rzxzDDP/KW+Qq5uG4E6NYQBMPdg5UA9KkQ66z4pbNVr6X4s7tTKrUW3/EN3z8FuxXzh d2mfYoyHxEl3YDWYkjTpjnvqrkecj887KbgdV6Du1Vlrw93ShVTE4DsVmykPSat8ccyE XuXtGb6UCNrsS9O0luwwMaZElhbraH+pw0tsk66QL16qvPFD5BsIpjMk0AE2037ZKChD M35A== X-Forwarded-Encrypted: i=1; AJvYcCVR+qmZCOelHFXDircDWXMT1DTlaA0dQ00v1h1K7SVuFj2eJ8pjStfm+MEEOWqQBth18DbMCuQqbQCB7MNFIqO8+GLm+e0QVtklaAXL X-Gm-Message-State: AOJu0YzKnLsW23cNBpuZCt34zeXk0VoctWK68KmwKlguTqDxPrbTcToC 7MAqmrw/PULBdkxppeEfkbmDc3TWb3V//o2kWOZRfAq/4ESt1yr3WGWhV8hbS/8= X-Google-Smtp-Source: AGHT+IGHVWuyebZDGCsij4vuuCGXUnlNacdJhnGzP0jhAixWhDpzQ1nmi4t3DPfRBlZrMwTir+WhcA== X-Received: by 2002:a2e:a58e:0:b0:2d9:fb60:9afa with SMTP id m14-20020a2ea58e000000b002d9fb609afamr1096872ljp.40.1714633540084; Thu, 02 May 2024 00:05:40 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id q26-20020a2e969a000000b002d860a40f9dsm69420lji.136.2024.05.02.00.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 00:05:39 -0700 (PDT) Date: Thu, 2 May 2024 10:05:35 +0300 From: Dan Carpenter To: Peng Fan Cc: "Peng Fan (OSS)" , Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , "soc@kernel.org" , Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Aisheng Dong , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , "Ghennadi Procopciuc (OSS)" , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-samsung-soc@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-rockchip@lists.infradead.org" , "linux-riscv@lists.infradead.org" , "linux-mediatek@lists.infradead.org" , "imx@lists.linux.dev" , "linux-aspeed@lists.ozlabs.org" , "openbmc@lists.ozlabs.org" Subject: Re: [PATCH 01/21] pinctrl: ti: iodelay: Use scope based of_node_put() cleanups Message-ID: <26aab31b-8085-49e0-862d-24c26ff4d02c@moroto.mountain> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> <20240501-pinctrl-cleanup-v1-1-797ceca46e5c@nxp.com> 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=us-ascii Content-Disposition: inline In-Reply-To: On Thu, May 02, 2024 at 12:28:42AM +0000, Peng Fan wrote: > > Subject: Re: [PATCH 01/21] pinctrl: ti: iodelay: Use scope based of_node_put() > > cleanups > > > > On Wed, May 01, 2024 at 08:55:59PM +0800, Peng Fan (OSS) wrote: > > > @@ -879,16 +874,12 @@ static int ti_iodelay_probe(struct > > platform_device *pdev) > > > ret = pinctrl_register_and_init(&iod->desc, dev, iod, &iod->pctl); > > > if (ret) { > > > dev_err(dev, "Failed to register pinctrl\n"); > > > - goto exit_out; > > > + return ret; > > > } > > > > > > platform_set_drvdata(pdev, iod); > > > > > > return pinctrl_enable(iod->pctl); > > > - > > > -exit_out: > > > - of_node_put(np); > > > - return ret; > > > } > > > > This will call of_node_put() on the success path so it's a behavior change. The > > original code is buggy, it's supposed to call of_node_put() on the success path > > here or in ti_iodelay_remove(). > > > > If it's supposed to call of_node_put() here, then fine, this is bugfix but if it's > > supposed to call it in ti_iodelay_remove() then we need to save the pointer > > somewhere using no_free_ptr(). Probably saving ->np is the safest choice? > > > > The original code is already a little bit buggy because it doesn't check for > > pinctrl_enable() errors and cleanup. > > It was introduced by > commit 6118714275f0a313ecc296a87ed1af32d9691bed (tag: pinctrl-v4.11-4) > Author: Tony Lindgren > Date: Thu Mar 30 09:16:39 2017 -0700 > > pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable() > > of_node_put is expected in probe, not in remove. > Ah, right. You'll add that for the Fixes tag obviously... regards, dan carpenter