mmc: atmel-mci: fix oops in atmci_tasklet_func
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / host / atmel-mci.c
index 5d68ac958112ea0c880066e220e1a620f4f38df6..b5c95043f7ef736f5ed7de83dc045cf736817412 100644 (file)
@@ -1794,12 +1794,14 @@ static void atmci_tasklet_func(unsigned long priv)
                        if (unlikely(status)) {
                                host->stop_transfer(host);
                                host->data = NULL;
-                               if (status & ATMCI_DTOE) {
-                                       data->error = -ETIMEDOUT;
-                               } else if (status & ATMCI_DCRCE) {
-                                       data->error = -EILSEQ;
-                               } else {
-                                       data->error = -EIO;
+                               if (data) {
+                                       if (status & ATMCI_DTOE) {
+                                               data->error = -ETIMEDOUT;
+                                       } else if (status & ATMCI_DCRCE) {
+                                               data->error = -EILSEQ;
+                                       } else {
+                                               data->error = -EIO;
+                                       }
                                }
                        }