cmd_line and cmd_preset in arch/ppc/boot/simple/misc.c

Leigh Brown leigh at solinno.co.uk
Thu Jan 27 05:55:13 EST 2005


Hi,

Could someone please confirm that I'm not going mad?  At least wrt
this ;-)  We have this code in misc.c:

#ifdef CONFIG_GEMINI
        /*
         * If cmd_line is empty and cmd_preset is not, copy cmd_preset
         * to cmd_line.  This way we can override cmd_preset with the
         * command line from Smon.
         */

        if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
                memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));
#endif

        /* Display standard Linux/PPC boot prompt for kernel args */
        puts("\nLinux/PPC load: ");
        cp = cmd_line;
        memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));


Surely the bit in the #ifdef is ineffective?  Also, as cmd_line is
initialised to zeros, I think this is better:

        /*
         * If cmd_line is empty and cmd_preset is not, copy cmd_preset
         * to cmd_line.  This way we can override cmd_preset with the
         * command line from Smon.
         */

        if ( (cmd_line[0] == '\0') && (cmd_preset[0] != '\0'))
                memcpy (cmd_line, cmd_preset, sizeof(cmd_preset));

        /* Display standard Linux/PPC boot prompt for kernel args */
        puts("\nLinux/PPC load: ");
        cp = cmd_line;

As, in the general case, cmd_line[0] will always be zero and
cmd_preset[0] will always be filled, so no need for an #ifdef.

If someone can confirm I'm not mistaken, I can send a patch...




More information about the Linuxppc-dev mailing list