Category: Linux

drivers/net/irda/mcs7780.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function mcs_probe() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to error2:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller …

Continue reading

drivers/net/irda/irtty-sir.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function irtty_open() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to out_put:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller …

Continue reading

drivers/net/irda/sh_irda.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function sh_irda_probe() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to err_mem_4:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller …

Continue reading

drivers/net/ethernet/sis/sis900.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function sis900_probe() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to err_out_cleardev:. Fore this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller …

Continue reading

drivers/net/ethernet/natsemi/natsemi.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function natsemi_probe1() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to err_create_file:. Fore this error case the function abort its success execution path, but returns non negative value, making it difficult for a caller …

Continue reading

drivers/net/ethernet/dec/tulip/dmfe.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function dmfe_init_one() return 0 for success and negative value for most of its internal tests failures. There are three exceptions that are error cases going to err_out_*:. Fore this three cases the function abort its success execution path, but returns non negative value, making it dificult for a caller …

Continue reading

drivers/rapidio/devices/tsi721.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> Convert a nonnegative error return code to a negative one, as returned elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... …

Continue reading

drivers/rtc/rtc-coh901331.c: use clk_prepare_enable() and clk_disable_unprepare()

Author: Julia Lawall <Julia.Lawall@lip6.fr> clk_prepare_enable and clk_disable_unprepare combine clk_prepare and clk_enable, and clk_disable and clk_unprepare. They make the code more concise, and ensure that clk_unprepare is called when clk_enable fails. A simplified version of the semantic patch that introduces calls to these functions is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; @@ – clk_prepare(e); – …

Continue reading

drivers/rtc/rtc-spear.c: fix several error checks

Author: Lars-Peter Clausen <lars@metafoo.de> There are several comparisons of a unsigned int to less than zero int spear RTC driver. Such a check will always be true. In all these cases a signed int is assigned to the unsigned variable, which is checked, before. So the right fix is to make the checked variable signed …

Continue reading

drivers/rtc/rtc-jz4740.c: fix IRQ error check

Author: Lars-Peter Clausen <lars@metafoo.de> The irq field of the jz4740_irc struct is unsigned. Yet we assign the result of platform_get_irq() to it. platform_get_irq() may return a negative error code and the code checks for this condition by checking if ‘irq’ is less than zero. But since ‘irq’ is unsigned this test will always be false. …

Continue reading