PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

CC: Nobuo Iwata <nobuo.iw...@fujixerox.co.jp>
Signed-off-by: Fengguang Wu <fengguang...@intel.com>
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---

I haven't checked the complete context, but the code looks suspicious.

 usbip_ux.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/usbip/usbip_ux.c
+++ b/drivers/usb/usbip/usbip_ux.c
@@ -571,7 +571,7 @@ static int __init usbip_ux_init(void)
        usbip_ux_dev = device_create(usbip_ux_class, NULL, usbip_ux_devno, 
NULL, USBIP_UX_DEV_NAME);
        if (IS_ERR(usbip_ux_dev)) {
                pr_err("Fail to create sysfs entry for %s\n", 
USBIP_UX_DEV_NAME);
-               ret = PTR_ERR(usbip_ux_class);
+               ret = PTR_ERR(usbip_ux_dev);
                goto err_cdev_del;
        }
        return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to