Re: [PATCH v2] iio: core: Replace BUG() with WARN_ON_ONCE() and error return

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Wed, Aug 26, 2026 at 09:31:40PM +0000, Rishab Madhugiri wrote:
> As documented in Documentation/process/deprecated.rst, the
> use of BUG() and BUG_ON() should be avoided as they could
> cause a complete system crash, preventing further debugging.

Right, but deprecation doesn't mean the _old_ existing code must be immediately
changed. I leave it to Jonathan, but I see no value in this change except
the unneeded churn. If we ever want to drop BUG(), it should be done tree wide.
Hence no tag given.

> In iio_get_time_ns() and current_timestamp_clock_show(), the
> clock type is already validated against supported clock
> types prior to these calls, making the default switch
> branches expected to be unreachable. Replace these with
> WARN_ON_ONCE(1) followed by an error return to avoid a
> crash and to log the highly unexpected condition.

There is like 10+ character space on each line, the commit message shouldn't
be that condensed.

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.