Merge tag 'pci-v5.1-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
[linux-2.6-microblaze.git] / drivers / spi / spi-topcliff-pch.c
index d794180..fba3f18 100644 (file)
@@ -1007,6 +1007,9 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
 
        /* RX */
        dma->sg_rx_p = kcalloc(num, sizeof(*dma->sg_rx_p), GFP_ATOMIC);
+       if (!dma->sg_rx_p)
+               return;
+
        sg_init_table(dma->sg_rx_p, num); /* Initialize SG table */
        /* offset, length setting */
        sg = dma->sg_rx_p;
@@ -1067,6 +1070,9 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
        }
 
        dma->sg_tx_p = kcalloc(num, sizeof(*dma->sg_tx_p), GFP_ATOMIC);
+       if (!dma->sg_tx_p)
+               return;
+
        sg_init_table(dma->sg_tx_p, num); /* Initialize SG table */
        /* offset, length setting */
        sg = dma->sg_tx_p;