--- zzzz-none-000/linux-3.10.107/drivers/net/wireless/p54/p54usb.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/net/wireless/p54/p54usb.c 2021-02-04 17:41:59.000000000 +0000 @@ -12,7 +12,6 @@ * published by the Free Software Foundation. */ -#include #include #include #include @@ -514,7 +513,7 @@ if (!buf) return -ENOMEM; - left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size); + left = block_size = min_t(size_t, P54U_FW_BLOCK, priv->fw->size); strcpy(buf, p54u_firmware_upload_3887); left -= strlen(p54u_firmware_upload_3887); tmp += strlen(p54u_firmware_upload_3887); @@ -980,6 +979,7 @@ if (err) { dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " "(%d)!\n", p54u_fwlist[i].fw, err); + usb_put_dev(udev); } return err; @@ -1053,6 +1053,10 @@ priv->upload_fw = p54u_upload_firmware_net2280; } err = p54u_load_firmware(dev, intf); + if (err) { + usb_put_dev(udev); + p54_free_common(dev); + } return err; }