mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/6] raspberry-pi: add leds support
Date: Mon, 19 Jan 2015 08:59:36 +0100	[thread overview]
Message-ID: <20150119075936.GQ18220@pengutronix.de> (raw)
In-Reply-To: <20150119115810.190c5d6680d88344250de9ee@gmail.com>

On Mon, Jan 19, 2015 at 11:58:10AM +0400, Antony Pavlov wrote:
> On Mon, 19 Jan 2015 08:51:44 +0100
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > On Mon, Jan 19, 2015 at 02:08:58AM +0400, Antony Pavlov wrote:
> > > On Tue, 13 Jan 2015 07:33:06 +0100
> > > Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:
> > > 
> > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > ---
> > > >  arch/arm/boards/raspberry-pi/rpi.c | 55 ++++++++++++++++++++++++++++++++++++++
> > > >  1 file changed, 55 insertions(+)
> > > > 
> > > > diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
> > > > index ae1e92a..81b485e 100644
> > > > --- a/arch/arm/boards/raspberry-pi/rpi.c
> > > > +++ b/arch/arm/boards/raspberry-pi/rpi.c
> > > ...
> > > > @@ -160,6 +205,15 @@ unknown_rev:
> > > >  	barebox_set_model("RaspberryPi (BCM2835/ARM1176JZF-S)");
> > > >  }
> > > >  
> > > > +static void rpi_model_init(void)
> > > > +{
> > > > +	if (!models[rpi_board_rev].init)
> > > > +		return;
> > > 
> > > Houston, we have a problem here.
> > > Please see current arch/arm/boards/raspberry-pi/rpi.c:
> > > 
> > > /* See comments in mbox.h for data source */
> > > static const struct {
> > > 	const char *name;
> > > 	bool has_onboard_eth;
> > > 	void (*init)(void);
> > > } models[] = {
> > > 	RPI_MODEL(0, "Unknown model", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_2, "Model B (no P5)", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_3, "Model B (no P5)", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_4, "Model B", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_5, "Model B", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_6, "Model B", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_A_7, "Model A", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_A_8, "Model A", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_A_9, "Model A", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_REV2_d, "Model B rev2", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_REV2_e, "Model B rev2", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_REV2_f, "Model B rev2", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_B_PLUS, "Model B+", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_CM, "Compute Module", NULL),
> > > 	RPI_MODEL(BCM2835_BOARD_REV_A_PLUS, "Model A+", NULL),
> > > };
> > > 
> > > All inits are NULLs!
> > > 
> > > Have we any chance to run rpi_add_led()?
> > 
> > Hm, no, this is never called. Maybe rpi_model_init() should look like
> > this instead?
> > 
> > static void rpi_model_init(void)
> > {
> > 	if (!models[rpi_board_rev].init)
> > 		models[rpi_board_rev].init();
> 
> 
> Do you really want to dereference NULL pointer?

Nah, drop the '!' of course.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-01-19  7:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  6:31 [PATCH 0/6 v2] raspberry-pi: updates Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33 ` [PATCH 1/6] raspberry-pi: add board model detection Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33   ` [PATCH 2/6] raspberry-pi: add leds support Jean-Christophe PLAGNIOL-VILLARD
2015-01-18 22:08     ` Antony Pavlov
2015-01-19  7:51       ` Sascha Hauer
2015-01-19  7:58         ` Antony Pavlov
2015-01-19  7:59           ` Sascha Hauer [this message]
2015-01-19 12:16       ` Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33   ` [PATCH 3/6] amba: pl011: add support for regulator Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33   ` [PATCH 4/6] driver: add postcore_platform_driver Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33   ` [PATCH 5/6] regulator: allow to use it with non DT device Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33   ` [PATCH 6/6] regulator: add bcm2835 driver Jean-Christophe PLAGNIOL-VILLARD
2015-01-14  6:24 ` [PATCH 0/6 v2] raspberry-pi: updates Sascha Hauer
2015-01-18 22:20 ` Antony Pavlov
  -- strict thread matches above, loose matches on Subject: below --
2015-01-13  6:24 [PATCH 0/6] " Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26 ` [PATCH 1/6] raspberry-pi: add board model detection Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26   ` [PATCH 2/6] raspberry-pi: add leds support Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  7:58     ` Antony Pavlov
2015-01-13  8:15       ` Jean-Christophe PLAGNIOL-VILLARD
2015-01-13 10:11         ` Antony Pavlov
2015-01-14  6:26           ` Sascha Hauer

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=20150119075936.GQ18220@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.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