Re: [PATCH v2] skd: fix assert typo

Eric Engestrom
2016-09-16T13:06:46Z

On Fri, Sep 16, 2016 at 08:40:54AM -0400, Jeff Moyer wrote:
> Eric Engestrom <eric.engestrom@imgtec.com> writes:
>
> > The assert was missing a `!` to become active, but since that would only turn
> > it into a complicated codepath for a pr_err(), let's simply replace it.
>
> The skd assert macro prints out file and line number, which would have
> been nice to keep. Sorry I didn't explicitly mention that last time.

I'm not a fan of duplicating code, so if you want to keep the SKD_ASSERT()
format, my suggestion would be to go with the v1 of this patch. It might
end up having an `if` that will always be true, but the compiler will most
likely take care of optimising that away :)

Cheers,
Eric

>
> -Jeff
>
> >
> > CC: Jeff Moyer <jmoyer@redhat.com>
> > Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> > ---
> > drivers/block/skd_main.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> > index 3822eae..c04e92a 100644
> > --- a/drivers/block/skd_main.c
> > +++ b/drivers/block/skd_main.c
> > @@ -1905,7 +1905,7 @@ static void skd_send_internal_skspcl(struct skd_device *skdev,
> > break;
> >
> > default:
> > - SKD_ASSERT("Don't know what to send");
> > + pr_err("Don't know what to send");
> > return;
> >
> > }
> > @@ -2105,7 +2105,7 @@ static void skd_complete_internal(struct skd_device *skdev,
> > break;
> >
> > default:
> > - SKD_ASSERT("we didn't send this");
> > + pr_err("we didn't send this");
> > }
> > }