From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D0FAC021B3 for ; Mon, 24 Feb 2025 06:00:06 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Z1VST2wqqz3cgg for ; Mon, 24 Feb 2025 16:59:53 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.105.4.254 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1740376789; cv=none; b=PhDKesD3RZJhoC79ub4XOb4abobcXTYp+Nq15TaAgI4VTtJFMtfv5b2WCAXFv92SIzUZvJFRIVL2NLjsauARdAAj97zux5EilmVqZqCCZsHp8cC0cT/5p6F4FcM0XbeRD0cOGNoslZRSfT4Nh6G917HFo6kRkdnKrPSFv7ubqJWY0dZgzv1MZy5rHNIjWLiE7syr1GkIRvSKEX5yJnMEyzuTax8gqmmOSv8pdz/zmDUkGeQ2XZ+TJe1Eab+yUBJxYRwK8A8eCXBxJ1yBdj7HPkj5ddCtFDXg0PCykntsVkUWhQHO0lsQEUI5JdMfgCugNnwymYORfXaAD30gq5ZR5Q== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1740376789; c=relaxed/relaxed; bh=uFvXOi+LUJMKwvGI3qUG435UWhEpNqevyHNPflNad3I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dqr99dnXP+Qng8bnoewecbM8FKDsWK3jjLChX0KgaURAXEOxwAUgFi/SaGEk8Hpxl5lVoqnmxMjeIS6kFtcX7Vbs5iDGk8PyLbfqIu6sGb+5DuQyTtF2beYgPmtvOv2O56mTq+32bp6oGFrg8Zjt1CaCOfhdqFktqwFF/AH0Ye92pujMDIz4JViz8MkEyQTSd1m3u44z8y3EhMH+1T0shBqpSkhOLXukrL4JpYMZUloz/MbM/vgxKn0LZGOCQNgjRho+yO33XPbAhopisbBBNqGZkYj53rfgYHFFvz3ULt6Ue9sYbZkoqvxmOf5sTgZjNmCobbcrX1xCd7LALhQEBg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nFhfYlTh; dkim-atps=neutral; spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=gregkh@linuxfoundation.org; receiver=lists.ozlabs.org) smtp.mailfrom=linuxfoundation.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nFhfYlTh; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linuxfoundation.org (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=gregkh@linuxfoundation.org; receiver=lists.ozlabs.org) X-Greylist: delayed 447 seconds by postgrey-1.37 at boromir; Mon, 24 Feb 2025 16:59:47 AEDT Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Z1VSM380Mz2xgv for ; Mon, 24 Feb 2025 16:59:46 +1100 (AEDT) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 12CEF61170; Mon, 24 Feb 2025 05:52:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3EF5C4CED6; Mon, 24 Feb 2025 05:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740376336; bh=53H9/x0j02AhPT7w+jFHCR4eR6p48BOhp4/DcjS/5+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nFhfYlTh/vn6++4NrrfuzW63KF6xlniD4USCI+6lyNK0LkAXyU6nIDl5SFg1zC3CY 8fULK3IP96tqdq8wj0IN9ERcTVWyWI3H3V9uAAtBXOlUWhDjNvrfCCJ7Iv899ih7hL 3+mhMk9Xko2hwR2SeMve8H0FOP832WEiYxQKehyY= Date: Mon, 24 Feb 2025 06:52:13 +0100 From: Greg KH To: Ricardo Ribalda Subject: Re: [PATCH 1/4] media: nuvoton: Fix reference handling of ece_pdev Message-ID: <2025022426-lilly-next-72e0@gregkh> References: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> <20250121-nuvoton-v1-1-1ea4f0cdbda2@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joseph Liu , Marvin Lin , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Hans Verkuil , Philipp Zabel , Mauro Carvalho Chehab , Marvin Lin , linux-media@vger.kernel.org Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Sun, Feb 23, 2025 at 07:34:30PM +0100, Ricardo Ribalda wrote: > On Fri, 21 Feb 2025 at 10:18, Hans Verkuil wrote: > > > > On 21/02/2025 10:04, Hans Verkuil wrote: > > > Hi Ricardo, > > > > > > On 21/01/2025 22:14, Ricardo Ribalda wrote: > > >> When we obtain a reference to of a platform_device, we need to release > > >> it via put_device. > > >> > > >> Found by cocci: > > >> ./platform/nuvoton/npcm-video.c:1677:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > >> ./platform/nuvoton/npcm-video.c:1684:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > >> ./platform/nuvoton/npcm-video.c:1690:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > >> ./platform/nuvoton/npcm-video.c:1694:1-7: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > > > > > This driver uses this construct: > > > > > > struct device *ece_dev __free(put_device) = &ece_pdev->dev; > > > > > > to automatically call put_device. So this patch would 'put' the device twice. > > > > > > Does cocci understand constructs like this? If I hadn't looked closely at the > > > code first, I would just have merged it. > > > > Oh wait, now that I am reading the following patches I see that it was those later > > patches that add the __free code. > > > > This is far too confusing. Please post a v2 that just combines the 'fix references' > > and 'use cleanup.h macros' in a single patch. It makes no sense to have this two-phase > > approach. > > I believe this is discouraged. > > cleanup.h macros does not exist in old kernel versions, so makes it > impossible to backport the fix to them. That's not a problem, fix things properly in the main tree and let the stable/lts kernels work it out on their own. > This is an example of other series following this policy: > https://lore.kernel.org/lkml/173608125422.1253657.3732758016133408588.stgit@devnote2/ > > They also mention the same here: > https://hackerbikepacker.com/kernel-auto-cleanup-1 .... I am pretty > sure that I read the policy in a more official location... but I > cannot find it right now :) No, it is NOT official policy at all. Otherwise you would be saying that no one could use these new functions for 6 years just because of really old kernels still living around somewhere. That's not how kernel development works, thankfully. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AD4341448E3; Mon, 24 Feb 2025 05:52:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740376337; cv=none; b=U81cF6A2X6/pFaIGIEbfTWT7I0eWEcmEWTKnjYecjMoyhrgl52zSnOdK8qyWw1DOJSpTJaz8HBDA97Vnsvu95w+aP5vSJMZ1IBi3O+qFL03v4l1yhjNKZMnf/sMQaW17QbmlBb0JGi6WiXiE0U6hj+YpAdOxZq5BZsvu3o8l5m0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740376337; c=relaxed/simple; bh=53H9/x0j02AhPT7w+jFHCR4eR6p48BOhp4/DcjS/5+M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qvyYW/l5WNzj09lI+29IjljfOOJQHYggw3aSQK+fVNMW6aratY8hWG3NJbUQh7WKXicc/+GeqiflVAbFUA1pJUzpx3lZ5AzSpBpggdmDxqefcj9jbdFmtNhcKoqaIgs83bFUM1I8epnT2mS6hTBOE7usPvZa0VtsRdXnqf79nC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nFhfYlTh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nFhfYlTh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3EF5C4CED6; Mon, 24 Feb 2025 05:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740376336; bh=53H9/x0j02AhPT7w+jFHCR4eR6p48BOhp4/DcjS/5+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nFhfYlTh/vn6++4NrrfuzW63KF6xlniD4USCI+6lyNK0LkAXyU6nIDl5SFg1zC3CY 8fULK3IP96tqdq8wj0IN9ERcTVWyWI3H3V9uAAtBXOlUWhDjNvrfCCJ7Iv899ih7hL 3+mhMk9Xko2hwR2SeMve8H0FOP832WEiYxQKehyY= Date: Mon, 24 Feb 2025 06:52:13 +0100 From: Greg KH To: Ricardo Ribalda Cc: Hans Verkuil , Joseph Liu , Marvin Lin , Mauro Carvalho Chehab , Philipp Zabel , Marvin Lin , linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/4] media: nuvoton: Fix reference handling of ece_pdev Message-ID: <2025022426-lilly-next-72e0@gregkh> References: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> <20250121-nuvoton-v1-1-1ea4f0cdbda2@chromium.org> Precedence: bulk X-Mailing-List: stable@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 Sun, Feb 23, 2025 at 07:34:30PM +0100, Ricardo Ribalda wrote: > On Fri, 21 Feb 2025 at 10:18, Hans Verkuil wrote: > > > > On 21/02/2025 10:04, Hans Verkuil wrote: > > > Hi Ricardo, > > > > > > On 21/01/2025 22:14, Ricardo Ribalda wrote: > > >> When we obtain a reference to of a platform_device, we need to release > > >> it via put_device. > > >> > > >> Found by cocci: > > >> ./platform/nuvoton/npcm-video.c:1677:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > >> ./platform/nuvoton/npcm-video.c:1684:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > >> ./platform/nuvoton/npcm-video.c:1690:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > >> ./platform/nuvoton/npcm-video.c:1694:1-7: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. > > > > > > This driver uses this construct: > > > > > > struct device *ece_dev __free(put_device) = &ece_pdev->dev; > > > > > > to automatically call put_device. So this patch would 'put' the device twice. > > > > > > Does cocci understand constructs like this? If I hadn't looked closely at the > > > code first, I would just have merged it. > > > > Oh wait, now that I am reading the following patches I see that it was those later > > patches that add the __free code. > > > > This is far too confusing. Please post a v2 that just combines the 'fix references' > > and 'use cleanup.h macros' in a single patch. It makes no sense to have this two-phase > > approach. > > I believe this is discouraged. > > cleanup.h macros does not exist in old kernel versions, so makes it > impossible to backport the fix to them. That's not a problem, fix things properly in the main tree and let the stable/lts kernels work it out on their own. > This is an example of other series following this policy: > https://lore.kernel.org/lkml/173608125422.1253657.3732758016133408588.stgit@devnote2/ > > They also mention the same here: > https://hackerbikepacker.com/kernel-auto-cleanup-1 .... I am pretty > sure that I read the policy in a more official location... but I > cannot find it right now :) No, it is NOT official policy at all. Otherwise you would be saying that no one could use these new functions for 6 years just because of really old kernels still living around somewhere. That's not how kernel development works, thankfully. thanks, greg k-h