[U-Boot-Users] console initialization

Luke Kim khkim at astel.co.kr
Wed Nov 29 06:13:45 CET 2006


Dear U-boot Developers

 

Hello, my name is Luke Kim from Korea. I've been looking at the u-boot code
for debugging, and I think I found something in function 'console_init_r'
function in file 'common/console.c'.

/***********************line 505****************************/

/* Scan devices looking for input and output devices */

    for (i = 1; 

         (i <= items) && ((inputdev == NULL) || (outputdev == NULL)); 

         i++

        ) {

        device_t *dev = ListGetPtrToItem (devlist, i);

 

        if ((dev->flags & DEV_FLAGS_INPUT) && (inputdev == NULL)) {

            inputdev = dev;

        }

        if ((dev->flags & DEV_FLAGS_OUTPUT) && (outputdev == NULL)) {

            outputdev = dev;

        }

    }

 

    /* Initializes output console first */

    if (outputdev != NULL) { 

        console_setfile (stdout, outputdev);

        console_setfile (stderr, outputdev);

    }

 

    /* Initializes input console */

    if (inputdev != NULL) { 

        console_setfile (stdin, inputdev);

    }

 

    gd->flags |= GD_FLG_DEVINIT;    /* device initialization completed */

At the last line, it sets the 'GD_FLG_DEVINIT' flag. But doesn't it have to
check 'inputdev' and 'outputdev' first to check if it's NULL? I think
functions such as 'fputc' will malfunction if the 'GD_FLG_DEVINIT' flag is
set when 'stdio_devices' are NULL.

 

Best Regards

Luke

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20061129/a3f883ab/attachment.htm 


More information about the U-Boot mailing list