On Tue, 25 Jul 2017 17:29:14 +0300
Dan Carpenter <dan.carpen...@oracle.com> wrote:

> Hello stephen hemminger,
> 
> The patch 7ca4593338e1: "netvsc: fix netvsc_set_channels" from Jul
> 24, 2017, leads to the following static checker warning:
> 
>       drivers/net/hyperv/netvsc_drv.c:761 netvsc_set_channels()
>       error: 'nvdev' is not an ERR_PTR
> 
>       drivers/net/hyperv/netvsc_drv.c:761 netvsc_set_channels()
>       warn: passing a valid pointer to 'PTR_ERR'
> 
> drivers/net/hyperv/netvsc_drv.c
>    753          memset(&device_info, 0, sizeof(device_info));
>    754          device_info.num_chn = count;
>    755          device_info.ring_size = ring_size;
>    756  
>    757          nvdev = rndis_filter_device_add(dev, &device_info);
>    758          if (!IS_ERR(nvdev)) {
>    759                  netif_set_real_num_tx_queues(net, nvdev->num_chn);
>    760                  netif_set_real_num_rx_queues(net, nvdev->num_chn);
>    761                  ret = PTR_ERR(nvdev);
>                         ^^^^^^^^^^^^^^^^^^^
>    762          } else {
>    763                  device_info.num_chn = orig;
>    764                  rndis_filter_device_add(dev, &device_info);
> 
> Should that be moved here?  It's not immediately clear to me what's
> happening here.
> 
>    765          }
>    766  
>    767          if (was_opened)
>    768                  rndis_filter_open(nvdev);
>    769  
> 
> 
> regards,
> dan carpenter

Thanks, yes this does cause incorrect return value.
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to