From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wg0-f53.google.com ([74.125.82.53]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TxH7e-0000bC-NM for barebox@lists.infradead.org; Mon, 21 Jan 2013 13:09:11 +0000 Received: by mail-wg0-f53.google.com with SMTP id fn15so3630432wgb.8 for ; Mon, 21 Jan 2013 05:09:09 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20130121125109.GA1906@pengutronix.de> References: <20130121102319.GE26329@game.jcrosoft.org> <1358764040-10690-1-git-send-email-plagnioj@jcrosoft.com> <1358764040-10690-8-git-send-email-plagnioj@jcrosoft.com> <20130121125109.GA1906@pengutronix.de> Date: Mon, 21 Jan 2013 14:09:08 +0100 Message-ID: From: Alexander Aring List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1529150205795174706==" Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 08/10] introduce common bootstrap code To: Sascha Hauer Cc: barebox --===============1529150205795174706== Content-Type: multipart/alternative; boundary=089e0122896ca395e504d3cc2a5e --089e0122896ca395e504d3cc2a5e Content-Type: text/plain; charset=UTF-8 Hi, ok, thanks for this information. Regards Alex 2013/1/21 Sascha Hauer > On Mon, Jan 21, 2013 at 12:04:16PM +0100, Alexander Aring wrote: > > hi, > > > > found a little 'things'. Maybe it's matter. > > > > > + > > > + cdev = cdev_open(name, O_RDONLY); > > > + if (!cdev) { > > > + bootstrap_err("failed to open partition\n"); > > > + return NULL; > > > + } > > > + > > > + ret = cdev_read(cdev, header, BAREBOX_HEAD_SIZE, 0, 0); > > > > > check on error here? > > > > This is done, see below. > > > > > > + cdev_close(cdev); > > > + > > > + if (ret != BAREBOX_HEAD_SIZE) { > > > + bootstrap_err("failed to read from partition\n"); > > > + return NULL; > > > + } > > > + > > > + return header; > > > +} > > > + > > > + > > > + if (!size) { > > > + size = default_size; > > > + bootstrap_err("%s: failed to detect barebox and it's > image > > > size so use %d\n", > > > + devname, size); > > > + } > > > + > > > + to = xmalloc(size); > > > > > check on null here? > > The x versions always return memory or else they panic. > > 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 | > --089e0122896ca395e504d3cc2a5e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

ok, thanks for this information.

Regards=
Alex


2013/1/21 Sascha Hauer <s.hauer@pengutronix.de>
On Mon, Jan 21, 2013 at 12= :04:16PM +0100, Alexander Aring wrote:
> hi,
>
> found a little 'things'. Maybe it's matter.
>
> > +
> > + =C2=A0 =C2=A0 =C2=A0 cdev =3D cdev_open(name, O_RDONLY);
> > + =C2=A0 =C2=A0 =C2=A0 if (!cdev) {
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bootstrap_err(= "failed to open partition\n");
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL; > > + =C2=A0 =C2=A0 =C2=A0 }
> > +
> > + =C2=A0 =C2=A0 =C2=A0 ret =3D cdev_read(cdev, header, BAREBOX_HE= AD_SIZE, 0, 0);
> >
> check on error here?
>

This is done, see below.

>
> > + =C2=A0 =C2=A0 =C2=A0 cdev_close(cdev);
> > +
> > + =C2=A0 =C2=A0 =C2=A0 if (ret !=3D BAREBOX_HEAD_SIZE) {
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bootstrap_err(= "failed to read from partition\n");
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL; > > + =C2=A0 =C2=A0 =C2=A0 }
> > +
> > + =C2=A0 =C2=A0 =C2=A0 return header;
> > +}
> > +
> > +
> > + =C2=A0 =C2=A0 =C2=A0 if (!size) {
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 size =3D defau= lt_size;
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bootstrap_err(= "%s: failed to detect barebox and it's image
> > size so use %d\n",
> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0devname, size);
> > + =C2=A0 =C2=A0 =C2=A0 }
> > +
> > + =C2=A0 =C2=A0 =C2=A0 to =3D xmalloc(size);
> >
> check on null here?

The x versions always return memory or else they panic.

Sascha


--
Pengutronix e.K. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
Industrial Linux Solutions =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 | http://w= ww.pengutronix.de/ =C2=A0|
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 =C2=A0 =C2=A0|<= br> Amtsgericht Hildesheim, HRA 2686 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | Fax: = =C2=A0 += 49-5121-206917-5555 |

--089e0122896ca395e504d3cc2a5e-- --===============1529150205795174706== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox --===============1529150205795174706==--