From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: "Luick, Dean" <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "John,
Jubin" <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org"
<devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org>,
"gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org"
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
"dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Date: Wed, 11 Nov 2015 17:39:21 +0300 [thread overview]
Message-ID: <20151111143921.GG18797@mwanda> (raw)
In-Reply-To: <4AF12E8016D2BF46BCDFCE8FAA77A3580BC19F69-AtyAts71sc9cIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
On Wed, Nov 11, 2015 at 02:03:02PM +0000, Luick, Dean wrote:
>
>
> > -----Original Message-----
> > From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
> > owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Dan Carpenter
> > Sent: Wednesday, November 11, 2015 2:45 AM
> > To: John, Jubin <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org; devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org; linux-
> > rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
> > Subject: Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device
> > description
> >
> > On Wed, Nov 11, 2015 at 02:33:32AM -0500, Jubin John wrote:
> > > +static int read_efi_var(const char *name, unsigned long *size,
> > > + void **return_data)
> > > +{
> > > + int ret;
> > > +
> > > + /* set failure return values */
> > > + *size = 0;
> > > + *return_data = NULL;
> > > +
> > > + /*
> > > + * Use EFI run-time support to obtain an EFI variable. Support may
> > > + * be compiled out, so declare all variables inside.
> > > + */
> > > + if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> >
> >
> > Flip this around:
> >
> > if (!efi_enabled(EFI_RUNTIME_SERVICES))
> > return -ENOSYS;
>
> The style here is very deliberate.
>
> The issue is how efi_enabled() is defined via CONFIG options.
> The function can be turned into a 0 if certain CONFIG variables are
> not set. The code is structured to make all of the dependent
> variables disappear if efi_enabled() becomes 0.
This all understand.
> If the code is shifted as you suggest, we will get builds from the
> automatic builders that try all combinations with unused variables.
> This was done to avoid that.
I'm not sure I understand. You are doing this to try tricking the
autobuilders into not testind certain configs? What? I don't
understand what you mean by unused variables. There shouldn't be any
unused variable warnings. If you are getting unused variable warnings
can you post one so that I can take a look?
Maybe you are worried the function is a waste of memory if you declare
the variables earlier before the if enabled check? It's not a problem.
The compiler is smart enough to see the immediate return and removes
the dead code.
Perhaps I am not seeing your concern.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-11-11 14:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 7:33 [PATCH 01/13] staging/rdma/hfi1: Use BIT macro Jubin John
[not found] ` <1447227213-15122-1-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-11-11 7:33 ` [PATCH 02/13] staging/rdma/hfi1: Fix downgrade race Jubin John
2015-11-11 7:33 ` [PATCH 03/13] staging/rdma/hfi1: remove RxCtxRHQS from hfi1stats Jubin John
2015-11-11 7:33 ` [PATCH 04/13] staging/rdma/hfi: Remove rcv bubbles code Jubin John
2015-11-11 7:33 ` [PATCH 05/13] staging/rdma/hfi1: Add space between concatenated string elements Jubin John
2015-11-11 7:33 ` [PATCH 06/13] staging/rdma/hfi1: Move s_sde to the read mostly portion of the hfi1_qp structure Jubin John
2015-11-11 7:33 ` [PATCH 07/13] staging/rdma/hfi1: rework is_a0() and is_bx() Jubin John
2015-11-11 7:33 ` [PATCH 08/13] staging/rdma/hfi1: change krcvqs module parameter type from byte to uint Jubin John
2015-11-11 7:33 ` [PATCH 09/13] staging/rdma/hfi1: Change default krcvqs Jubin John
2015-11-11 7:33 ` [PATCH 10/13] staging/rdma/hfi1: adding per SDMA engine stats to hfistats Jubin John
[not found] ` <1447227213-15122-10-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-11-11 8:22 ` Dan Carpenter
2015-11-16 21:33 ` Jubin John
2015-11-11 7:33 ` [PATCH 11/13] staging/rdma/hfi1: Remove unneeded variable index Jubin John
2015-11-11 7:33 ` [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description Jubin John
[not found] ` <1447227213-15122-12-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-11-11 8:44 ` Dan Carpenter
2015-11-11 14:03 ` Luick, Dean
[not found] ` <4AF12E8016D2BF46BCDFCE8FAA77A3580BC19F69-AtyAts71sc9cIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-11-11 14:39 ` Dan Carpenter [this message]
2015-11-11 15:03 ` Luick, Dean
[not found] ` <4AF12E8016D2BF46BCDFCE8FAA77A3580BC19FC8-AtyAts71sc9cIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-11-11 17:24 ` gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
[not found] ` <20151111172411.GA20481-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2015-11-12 12:31 ` Luick, Dean
2015-11-11 7:33 ` [PATCH 13/13] staging/rdma/hfi1: Adjust EPROM partitions, add EPROM commands Jubin John
2015-11-13 13:15 ` [PATCH 01/13] staging/rdma/hfi1: Use BIT macro Sudip Mukherjee
2015-11-13 16:09 ` Jubin John
[not found] ` <20151113160921.GA31028-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-11-13 18:03 ` Jubin John
[not found] ` <20151113180344.GA10934-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-11-13 18:25 ` Jubin John
2015-11-14 7:11 ` Sudip Mukherjee
2015-11-16 21:21 ` Jubin John
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=20151111143921.GG18797@mwanda \
--to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).