From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YD7Fe-0000UY-Ra for barebox@lists.infradead.org; Mon, 19 Jan 2015 07:59:59 +0000 Date: Mon, 19 Jan 2015 08:59:36 +0100 From: Sascha Hauer Message-ID: <20150119075936.GQ18220@pengutronix.de> References: <20150113063128.GC30554@ns203013.ovh.net> <1421130790-1164-1-git-send-email-plagnioj@jcrosoft.com> <1421130790-1164-2-git-send-email-plagnioj@jcrosoft.com> <20150119020858.8ba6db8d84cb7e795078ba99@gmail.com> <20150119075144.GO18220@pengutronix.de> <20150119115810.190c5d6680d88344250de9ee@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150119115810.190c5d6680d88344250de9ee@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 2/6] raspberry-pi: add leds support To: Antony Pavlov Cc: barebox@lists.infradead.org On Mon, Jan 19, 2015 at 11:58:10AM +0400, Antony Pavlov wrote: > On Mon, 19 Jan 2015 08:51:44 +0100 > Sascha Hauer 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 wrote: > > > > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > > > > --- > > > > 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