hyperv: Fix error return code in netvsc_init_buf()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Wed, 23 Jul 2014 01:00:35 +0000 (09:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jul 2014 21:55:47 +0000 (14:55 -0700)
Fix to return -ENOMEM from the kalloc error handling
case instead of 0.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc.c

index 4ed38eaecea805b72349f64b8dede105b5a4fcf4..d97d5f39a04e4a307bb1e5b53eaab18a85b6b828 100644 (file)
@@ -378,8 +378,10 @@ static int netvsc_init_buf(struct hv_device *device)
 
        net_device->send_section_map =
                kzalloc(net_device->map_words * sizeof(ulong), GFP_KERNEL);
-       if (net_device->send_section_map == NULL)
+       if (net_device->send_section_map == NULL) {
+               ret = -ENOMEM;
                goto cleanup;
+       }
 
        goto exit;