devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Devicetree Discuss <devicetree-discuss@lists.ozlabs.org>,
	Jerry Van Baren <vanbaren@cideas.com>,
	Tom Warren <twarren@nvidia.com>
Subject: Re: [PATCH 1/2] fdt: Avoid early panic() when there is no FDT present
Date: Thu, 29 Mar 2012 08:30:15 +0200	[thread overview]
Message-ID: <20120329063015.85A59202B18@gemini.denx.de> (raw)
In-Reply-To: <1332965305-21151-1-git-send-email-sjg@chromium.org>

Dear Simon Glass,

In message <1332965305-21151-1-git-send-email-sjg@chromium.org> you wrote:
> CONFIG_OF_CONTROL requires a valid device tree. However, we cannot call
> panic() before the console is set up since the message does not appear,
> and we get a silent failure.
...
> +int fdtdec_prepare_fdt(void);
> +
> +/**
> + * Checks that we have a valid fdt available to control U-Boot.
> +
> + * However, if not then for the moment nothing is done, since this function
> + * is called too early to panic().
> + *
> + * @returns 0

If the function always returns 0, then it makes no sense to return any
value at all.  Please make it void, then.

> +int fdtdec_check_fdt(void)
> +{
> +	/*
> +	 * We must have an FDT, but we cannot panic() yet since the console
> +	 * is not ready. So for now, just assert(). Boards which need an early
> +	 * FDT (prior to console ready) will need to make their own
> +	 * arrangements and do their own checks.
> +	 */
> +	assert(!fdtdec_prepare_fdt());
> +	return 0;
> +}

Ditto - make that "void fdtdec_check_fdt(void)".

> +int fdtdec_prepare_fdt(void)
...
>  	return 0;
>  }

Ditto - make that "void fdtdec_prepare_fdt(void)".


I have to admit that I do not understand how this patch will help you
anything.  You write "we cannot panic()", but "just assert()".

If the assertion fails, it will call __assert_fail() - which in turn
will just call panic().  So you are out of the frying pan into the
fire.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Life. Don't talk to me about life.      - Marvin the Paranoid Android

  parent reply	other threads:[~2012-03-29  6:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28 20:08 [PATCH 1/2] fdt: Avoid early panic() when there is no FDT present Simon Glass
2012-03-28 20:32 ` Tom Warren
2012-03-29  6:30 ` Wolfgang Denk [this message]
2012-03-29 15:57   ` Simon Glass

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=20120329063015.85A59202B18@gemini.denx.de \
    --to=wd@denx.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=sjg@chromium.org \
    --cc=twarren@nvidia.com \
    --cc=u-boot@lists.denx.de \
    --cc=vanbaren@cideas.com \
    /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).