linux-next/include/linux/mtd/pfow.h: possible poor sequence of conditionals ?

David Binderman dcb314 at hotmail.com
Tue Mar 22 07:49:06 PDT 2016


Hello there,

> [linux-next/include/linux/mtd/pfow.h:133]: (style) Expression is always false because 'else if' condition matches previous condition at line 130.
> [linux-next/include/linux/mtd/pfow.h:136]: (style) Expression is always false because 'else if' condition matches previous condition at line 130.

Source code is

    if (prog_status & 0x03)
        printk(KERN_NOTICE"DSR.9,8: (11) Attempt to program invalid "
                        "half with 41h command\n");
    else if (prog_status & 0x02)
        printk(KERN_NOTICE"DSR.9,8: (10) Object Mode Program attempt "
                    "in region with Control Mode data\n");
    else if (prog_status &  0x01)
        printk(KERN_NOTICE"DSR.9,8: (01) Program attempt in region "
                        "with Object Mode data\n");

Maybe something like

    switch (prog_status & 0x03)
    {
        case 0x03:
            printk(); break;
        case 0x02:
            printk(); break;
        case 0x01:
            printk(); break;
    }

might be better code.


Regards

David Binderman

 		 	   		  


More information about the linux-mtd mailing list