From: Wolfgang Denk Date: Sun, 23 Aug 2009 21:01:34 +0200 Subject: [U-Boot] [RFC PATCH 3/3] stdio/serial: factorize retrieve current device In-Reply-To: <1251034019-10787-3-git-send-email-plagnioj@jcrosoft.com> References: <20090823125957.GC11950@game.jcrosoft.org> <1251034019-10787-1-git-send-email-plagnioj@jcrosoft.com> <1251034019-10787-2-git-send-email-plagnioj@jcrosoft.com> <1251034019-10787-3-git-send-email-plagnioj@jcrosoft.com> Message-ID: <20090823190134.8B4B0833DBD2@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Jean-Christophe PLAGNIOL-VILLARD, In message <1251034019-10787-3-git-send-email-plagnioj@jcrosoft.com> you wrote: > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Please add a commit message that exaplains what you are doing. Your Subject: line is not sufficient. > +int serial_init (void) > +{ > + struct stdio_dev *dev = serial_get_current_device(); > > - if (serial_current->start) > - return serial_current->start (serial_current); > + if (dev->start) > + return dev->start (dev); What happens if dev == NULL ? > void serial_setbrg (void) > { > - if (!(gd->flags & GD_FLG_RELOC) || !serial_current) { > - struct stdio_dev *dev = default_serial_console (); > - > - dev->setbrg (dev); > - return; > - } > + struct stdio_dev *dev = serial_get_current_device(); > > - serial_current->setbrg (serial_current); > + dev->setbrg (dev); What happens if dev == NULL ? etc. 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 at denx.de No question is too silly to ask. Of course, some questions are too silly to to answer... - L. Wall & R. L. Schwartz, _Programming Perl_