All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Marek Vasut <marex@denx.de>
Cc: linux-iio@vger.kernel.org, Daniel Baluta <daniel.baluta@nxp.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] iio: core: WARN in case sample bits do not fit storage bits
Date: Mon, 21 Mar 2022 18:10:43 +0200	[thread overview]
Message-ID: <Yjijg7m+TnaMs519@smile.fi.intel.com> (raw)
In-Reply-To: <8b6f00be-c520-45c3-4497-d0fc310ff52f@denx.de>

On Mon, Mar 21, 2022 at 03:46:51PM +0100, Marek Vasut wrote:
> On 3/21/22 11:40, Andy Shevchenko wrote:
> > On Sun, Mar 20, 2022 at 07:15:42PM +0100, Marek Vasut wrote:
> > > Add runtime check to verify whether storagebits are at least as big
> > > as shifted realbits. This should help spot broken drivers which may
> > > set realbits + shift above storagebits.
> > 
> > Thanks!
> > 
> > ...
> > 
> > > +			/* Verify that sample bits fit into storage */
> > > +			WARN_ON(channels[i].scan_type.storagebits <
> > > +				channels[i].scan_type.realbits +
> > > +				channels[i].scan_type.shift);
> > 
> > Not sure WARN is a good level (it might be fatal on some setups and we won't that),
> > besides the fact that we may use dev_WARN(). Perhaps dev_warn() would suffice?
> 
> I was actually thinking about BUG(), but that might crash existing systems.
> I think we want a strong indicator that something wrong is going on which
> must be fixed and the splat produced by WARN_ON() is a good indicator of
> that. It also does not crash existing systems,

It does crash _some_ of them, unfortunately.

> so even if existing users get
> a warning now, they won't get an unbootable system and can report that
> warning.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-03-21 16:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20 18:15 [PATCH] iio: core: WARN in case sample bits do not fit storage bits Marek Vasut
2022-03-21  9:08 ` Sa, Nuno
2022-03-21 10:40 ` Andy Shevchenko
2022-03-21 14:46   ` Marek Vasut
2022-03-21 16:10     ` Andy Shevchenko [this message]
2022-03-21 19:46       ` Marek Vasut
2022-03-22  7:43         ` Nuno Sá
2022-03-22  9:49           ` Andy Shevchenko
2022-03-22  9:57             ` Marek Vasut
2022-03-22 10:10               ` Nuno Sá
2022-03-22 11:17                 ` Marek Vasut

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=Yjijg7m+TnaMs519@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=daniel.baluta@nxp.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=marex@denx.de \
    /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.