sfc: allow asynchronous MCDI without completion function
authorBert Kenward <bkenward@solarflare.com>
Thu, 11 Aug 2016 12:01:21 +0000 (13:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Aug 2016 03:42:19 +0000 (20:42 -0700)
Signed-off-by: Bert Kenward <bkenward@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/mcdi.c

index d28e7dd8fa3ca4c9863f21eb6c7aa0f1cde0c9fd..9fbc12a8f80ce1b72a5c1dc25ab31ea0ed681cce 100644 (file)
@@ -548,7 +548,10 @@ static bool efx_mcdi_complete_async(struct efx_mcdi_iface *mcdi, bool timeout)
                efx_mcdi_display_error(efx, async->cmd, async->inlen, errbuf,
                                       err_len, rc);
        }
-       async->complete(efx, async->cookie, rc, outbuf, data_len);
+
+       if (async->complete)
+               async->complete(efx, async->cookie, rc, outbuf,
+                               min(async->outlen, data_len));
        kfree(async);
 
        efx_mcdi_release(mcdi);