lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 28 Oct 2017 22:56:31 +0200 From: SF Markus Elfring <elfring@...rs.sourceforge.net> To: netdev@...r.kernel.org, linux-usb@...r.kernel.org, UNGLinuxDriver@...rochip.com, Woojung Huh <woojung.huh@...rochip.com> Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org Subject: [PATCH] lan78xx: Use common error handling code in lan78xx_phy_init() From: Markus Elfring <elfring@...rs.sourceforge.net> Date: Sat, 28 Oct 2017 22:42:52 +0200 * Add a jump target so that a specific error message is stored only once at the end of this function implementation. * Replace two calls of the function "netdev_err" by goto statements. * Adjust two condition checks. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net> --- drivers/net/usb/lan78xx.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 0161f77641fa..ff07e20621e3 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2030,17 +2030,15 @@ static int lan78xx_phy_init(struct lan78xx_net *dev) /* external PHY fixup for KSZ9031RNX */ ret = phy_register_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0, ksz9031rnx_fixup); - if (ret < 0) { - netdev_err(dev->net, "fail to register fixup\n"); - return ret; - } + if (ret) + goto report_fixup_failure; + /* external PHY fixup for LAN8835 */ ret = phy_register_fixup_for_uid(PHY_LAN8835, 0xfffffff0, lan8835_fixup); - if (ret < 0) { - netdev_err(dev->net, "fail to register fixup\n"); - return ret; - } + if (ret) + goto report_fixup_failure; + /* add more external PHY fixup here if needed */ phydev->is_internal = false; @@ -2093,6 +2091,10 @@ static int lan78xx_phy_init(struct lan78xx_net *dev) phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0); return ret; + +report_fixup_failure: + netdev_err(dev->net, "fail to register fixup\n"); + return ret; } static int lan78xx_set_rx_max_frame_length(struct lan78xx_net *dev, int size) -- 2.14.3
Powered by blists - more mailing lists