Re: [PATCH] ALSA: oss: Drop redundant nonseekable_open() return check

From: Bui Duc Phuc

Date: Thu Jul 09 2026 - 07:10:25 EST


Hi Dan Carpenter,

Thank you for your feedback.

> >
> > The idea is that it might return errors in the future.
> >

I looked at the history of nonseekable_open(). It has existed since Linux 2.6
days, for over 20 years, and its behavior has remained unchanged.
The comment still explicitly states:
"The function is not supposed to ever fail..."
It also explains that the function returns int only so that it can be plugged
directly into file_operations, not because callers are expected to
handle errors.

I also checked the current kernel tree. nonseekable_open() is
referenced from 86 files,
and the overwhelming majority of callers ignore its return value
entirely, following the
documented API contract. Only three callers checked the return value:

+ GPIO (already applied):
https://lore.kernel.org/all/178332860255.18708.5813708689955494780.b4-ty@xxxxxxxxxxxxxxxx/
+ DRM:
https://lore.kernel.org/all/20260703020919.7958-1-phucduc.bui@xxxxxxxxx/
+ASoC:
https://lore.kernel.org/all/20260702084445.519669-1-phucduc.bui@xxxxxxxxx/

If nonseekable_open() were ever changed to return real errors, that
would change its
long-established API contract and would affect a large number of
existing callers.
Such a change would require updating those callers across the kernel,
rather than
relying on a few isolated defensive checks.

Given its documented semantics, its unchanged behavior for over two decades,
and how it is actually used throughout the kernel, I don't think
keeping redundant
error handling here provides any practical benefit.


>
> > Also the patch is kind of sloppy...
>
> The sloppiness was fixed in v2. It's weird that there were no review
> comments on lore for this patch. Are people sending private reviews
> now?

I was reading through the code and creating patches at the same time,
so I submitted cleanups as I found them. That made the earlier patches
somewhat inconsistent.
After Takashi-san reviewed one of the patches, I applied the same improvements
to the rest of the series and sent them in v2.
There were no private reviews. The feedback was entirely public:
https://lore.kernel.org/all/87echlam6x.wl-tiwai@xxxxxxx/

Best regards,
Phuc