[U-Boot] [RFC PATCH 3/3] stdio/serial: factorize retrieve current device

Wolfgang Denk wd at denx.de
Sun Aug 23 21:01:34 CEST 2009


Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1251034019-10787-3-git-send-email-plagnioj at jcrosoft.com> you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>

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_


More information about the U-Boot mailing list