sfc: check async completer is !NULL before calling
authorBert Kenward <bkenward@solarflare.com>
Thu, 22 Sep 2016 14:47:45 +0000 (15:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Sep 2016 11:18:35 +0000 (07:18 -0400)
Add a NULL check before calling asynchronous MCDI completion functions
during device removal.

Fixes: 7014d7f6 ("sfc: allow asynchronous MCDI without completion function")
Signed-off-by: Bert Kenward <bkenward@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/mcdi.c

index 9fbc12a8f80ce1b72a5c1dc25ab31ea0ed681cce..241520943adaebf353aaf7eb53d7fc8d5c450310 100644 (file)
@@ -1156,7 +1156,8 @@ void efx_mcdi_flush_async(struct efx_nic *efx)
         * acquired locks in the wrong order.
         */
        list_for_each_entry_safe(async, next, &mcdi->async_list, list) {
-               async->complete(efx, async->cookie, -ENETDOWN, NULL, 0);
+               if (async->complete)
+                       async->complete(efx, async->cookie, -ENETDOWN, NULL, 0);
                list_del(&async->list);
                kfree(async);
        }