linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Alex Elder <elder@linaro.org>
Cc: davem@davemloft.net, kuba@kernel.org, bjorn.andersson@linaro.org,
	evgreen@chromium.org, cpratapa@codeaurora.org, elder@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 4/4] net: ipa: activate some commented assertions
Date: Fri, 19 Mar 2021 17:17:51 +0200	[thread overview]
Message-ID: <YFTAn7tHBAG2PO78@unreal> (raw)
In-Reply-To: <7520639c-f08b-cb25-1a62-7e3d69981f95@linaro.org>

On Fri, Mar 19, 2021 at 07:40:21AM -0500, Alex Elder wrote:
> On 3/19/21 12:00 AM, Leon Romanovsky wrote:
> > On Thu, Mar 18, 2021 at 11:29:23PM -0500, Alex Elder wrote:
> > > Convert some commented assertion statements into real calls to
> > > ipa_assert().  If the IPA device pointer is available, provide it,
> > > otherwise pass NULL for that.
> > > 
> > > There are lots more places to convert, but this serves as an initial
> > > verification of the new mechanism.  The assertions here implement
> > > both runtime and build-time assertions, both with and without the
> > > device pointer.
> > > 
> > > Signed-off-by: Alex Elder <elder@linaro.org>
> > > ---
> > >   drivers/net/ipa/ipa_reg.h   | 7 ++++---
> > >   drivers/net/ipa/ipa_table.c | 5 ++++-
> > >   2 files changed, 8 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h
> > > index 732e691e9aa62..d0de85de9f08d 100644
> > > --- a/drivers/net/ipa/ipa_reg.h
> > > +++ b/drivers/net/ipa/ipa_reg.h
> > > @@ -9,6 +9,7 @@
> > >   #include <linux/bitfield.h>
> > >   #include "ipa_version.h"
> > > +#include "ipa_assert.h"
> > >   struct ipa;
> > > @@ -212,7 +213,7 @@ static inline u32 ipa_reg_bcr_val(enum ipa_version version)
> > >   			BCR_HOLB_DROP_L2_IRQ_FMASK |
> > >   			BCR_DUAL_TX_FMASK;
> > > -	/* assert(version != IPA_VERSION_4_5); */
> > > +	ipa_assert(NULL, version != IPA_VERSION_4_5);
> > 
> > This assert will fire for IPA_VERSION_4_2, I doubt that this is
> > something you want.
> 
> No, it will only fail if version == IPA_VERSION_4_5.
> The logic of an assertion is the opposite of BUG_ON().
> It fails only if the asserted condition yields false.

ok, this ipa_reg_bcr_val() is called in only one place and has a
protection from IPA_VERSION_4_5, why don't you code it at the same
.c file instead of adding useless assert?

> 
> 					-Alex
> 
> > 
> > Thanks
> > 
> 

  reply	other threads:[~2021-03-19 15:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19  4:29 [PATCH net-next 0/4] net: ipa: fix validation Alex Elder
2021-03-19  4:29 ` [PATCH net-next 1/4] net: ipa: fix init header command validation Alex Elder
2021-03-19  4:29 ` [PATCH net-next 2/4] net: ipa: fix IPA validation Alex Elder
2021-03-19  4:29 ` [PATCH net-next 3/4] net: ipa: introduce ipa_assert() Alex Elder
2021-03-19  4:55   ` Leon Romanovsky
2021-03-19 12:38     ` Alex Elder
2021-03-19 15:32       ` Leon Romanovsky
2021-03-19 16:01         ` Alex Elder
2021-03-19 18:20     ` Andrew Lunn
2021-03-19  4:29 ` [PATCH net-next 4/4] net: ipa: activate some commented assertions Alex Elder
2021-03-19  5:00   ` Leon Romanovsky
2021-03-19 12:40     ` Alex Elder
2021-03-19 15:17       ` Leon Romanovsky [this message]
2021-03-19 15:32         ` Alex Elder
2021-03-19 18:32   ` Andrew Lunn
2021-03-19 21:18     ` Alex Elder
2021-03-19 21:30       ` Andrew Lunn
2021-03-20 13:24 ` [PATCH net-next 0/4] net: ipa: fix validation Alex Elder
2021-03-20 14:23   ` Alex Elder

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=YFTAn7tHBAG2PO78@unreal \
    --to=leon@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cpratapa@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=elder@linaro.org \
    --cc=evgreen@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).