All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Joseph Liu <kwliu@nuvoton.com>, Marvin Lin <milkfafa@gmail.com>,
	openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Marvin Lin <kflin@nuvoton.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 1/4] media: nuvoton: Fix reference handling of ece_pdev
Date: Mon, 24 Feb 2025 06:52:13 +0100	[thread overview]
Message-ID: <2025022426-lilly-next-72e0@gregkh> (raw)
In-Reply-To: <CANiDSCsMCSJMEsY3R=pnZ4XUTiEYuPz-N1kEX7y13yTzE6Dm5w@mail.gmail.com>

On Sun, Feb 23, 2025 at 07:34:30PM +0100, Ricardo Ribalda wrote:
> On Fri, 21 Feb 2025 at 10:18, Hans Verkuil <hverkuil@xs4all.nl> 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

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, Joseph Liu <kwliu@nuvoton.com>,
	Marvin Lin <kflin@nuvoton.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Marvin Lin <milkfafa@gmail.com>,
	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
Date: Mon, 24 Feb 2025 06:52:13 +0100	[thread overview]
Message-ID: <2025022426-lilly-next-72e0@gregkh> (raw)
In-Reply-To: <CANiDSCsMCSJMEsY3R=pnZ4XUTiEYuPz-N1kEX7y13yTzE6Dm5w@mail.gmail.com>

On Sun, Feb 23, 2025 at 07:34:30PM +0100, Ricardo Ribalda wrote:
> On Fri, 21 Feb 2025 at 10:18, Hans Verkuil <hverkuil@xs4all.nl> 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

  reply	other threads:[~2025-02-24  6:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 21:14 [PATCH 0/4] media: nuvoton: Fix some reference handling issues Ricardo Ribalda
2025-01-21 21:14 ` Ricardo Ribalda
2025-01-21 21:14 ` [PATCH 1/4] media: nuvoton: Fix reference handling of ece_pdev Ricardo Ribalda
2025-01-21 21:14   ` Ricardo Ribalda
2025-02-21  9:04   ` Hans Verkuil
2025-02-21  9:04     ` Hans Verkuil
2025-02-21  9:18     ` Hans Verkuil
2025-02-21  9:18       ` Hans Verkuil
2025-02-23 18:34       ` Ricardo Ribalda
2025-02-23 18:34         ` Ricardo Ribalda
2025-02-24  5:52         ` Greg KH [this message]
2025-02-24  5:52           ` Greg KH
2025-02-24  6:34           ` Ricardo Ribalda
2025-02-24  6:34             ` Ricardo Ribalda
2025-02-21 13:01     ` [cocci] " Markus Elfring
2025-02-21 13:01       ` Markus Elfring
2025-02-21 13:01       ` Markus Elfring
2025-01-21 21:14 ` [PATCH 2/4] media: nuvoton: Fix reference handling of ece_node Ricardo Ribalda
2025-01-21 21:14   ` Ricardo Ribalda
2025-01-21 21:14 ` [PATCH 3/4] media: nuvoton: Use cleanup.h macros for device_node Ricardo Ribalda
2025-01-21 21:14   ` Ricardo Ribalda
2025-01-21 21:14 ` [PATCH 4/4] media: nuvoton: Use cleanup.h macros for put_device Ricardo Ribalda
2025-01-21 21:14   ` Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2025022426-lilly-next-72e0@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=hverkuil@xs4all.nl \
    --cc=kflin@nuvoton.com \
    --cc=kwliu@nuvoton.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=milkfafa@gmail.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=p.zabel@pengutronix.de \
    --cc=ribalda@chromium.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.