Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58fe4313 authored by Wei Yongjun's avatar Wei Yongjun Committed by John W. Linville
Browse files

zd1201: fix error return code



Fix to return -ENOMEM in the memory alloc error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cfcd926e
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -75,8 +75,10 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw)
        len = fw_entry->size;
        len = fw_entry->size;


	buf = kmalloc(1024, GFP_ATOMIC);
	buf = kmalloc(1024, GFP_ATOMIC);
	if (!buf)
	if (!buf) {
		err = -ENOMEM;
		goto exit;
		goto exit;
	}
	
	
	while (len > 0) {
	while (len > 0) {
		int translen = (len > 1024) ? 1024 : len;
		int translen = (len > 1024) ? 1024 : len;
@@ -1762,8 +1764,10 @@ static int zd1201_probe(struct usb_interface *interface,
	zd->endp_out2 = 2;
	zd->endp_out2 = 2;
	zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
	zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
	zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
	zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
	if (!zd->rx_urb || !zd->tx_urb)
	if (!zd->rx_urb || !zd->tx_urb) {
		err = -ENOMEM;
		goto err_zd;
		goto err_zd;
	}


	mdelay(100);
	mdelay(100);
	err = zd1201_drvr_start(zd);
	err = zd1201_drvr_start(zd);