[PATCH 02/14] lmb: Use CONFIG_LMB_*_REGIONS only if they are defined
Tom Rini
trini at konsulko.com
Sun Aug 29 20:02:02 CEST 2021
On Sun, Aug 29, 2021 at 06:26:23PM +0200, Marek Vasut wrote:
> On 8/15/21 9:47 PM, Tom Rini wrote:
> > On Sun, Aug 15, 2021 at 08:13:02PM +0200, Marek Vasut wrote:
> >
> > > The CONFIG_LMB_*_REGIONS are defined only if CONFIG_LMB is enabled,
> > > protect access to those two config options to avoid undefined macro
> > > errors.
> > >
> > > Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> > > Cc: Simon Glass <sjg at chromium.org>
> > > Cc: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> > > Cc: Tom Rini <trini at konsulko.com>
> > > ---
> > > include/lmb.h | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/lmb.h b/include/lmb.h
> > > index 3c4afdf9f0..fa1474a360 100644
> > > --- a/include/lmb.h
> > > +++ b/include/lmb.h
> > > @@ -44,7 +44,7 @@ struct lmb_property {
> > > struct lmb_region {
> > > unsigned long cnt;
> > > unsigned long max;
> > > -#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > +#if IS_ENABLED(CONFIG_LMB) && IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
This doesn't make sense to me, still. You cannot enable
CONFIG_LMB_USE_MAX_REGIONS without CONFIG_LMB as the former depends on
the latter in Kconfig.
> > > struct lmb_property region[CONFIG_LMB_MAX_REGIONS];
> > > #else
> > > struct lmb_property *region;
> > > @@ -67,7 +67,7 @@ struct lmb_region {
> > > struct lmb {
> > > struct lmb_region memory;
> > > struct lmb_region reserved;
> > > -#if !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > +#if IS_ENABLED(CONFIG_LMB) && !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
> > > struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
> > > #endif
> >
> > We shouldn't need this at all. LMB and LMB_USE_MAX_REGIONS are both in
> > Kconfig and have the dependencies expressed that way.
>
> However, CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS may be
> undefined if CONFIG_LMB and !CONFIG_LMB_USE_MAX_REGIONS . They are four
> different symbols.
I'm still not seeing it, sorry. Is there some case where we're trying
to access a struct lmb without CONFIG_LMB enabled?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210829/f06edd4d/attachment.sig>
More information about the U-Boot
mailing list