hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/hid/intel-ish-hid/ishtp/dma-if.c
....@@ -104,6 +104,11 @@
104104 int required_slots = (size / DMA_SLOT_SIZE)
105105 + 1 * (size % DMA_SLOT_SIZE != 0);
106106
107
+ if (!dev->ishtp_dma_tx_map) {
108
+ dev_err(dev->devc, "Fail to allocate Tx map\n");
109
+ return NULL;
110
+ }
111
+
107112 spin_lock_irqsave(&dev->ishtp_dma_tx_lock, flags);
108113 for (i = 0; i <= (dev->ishtp_dma_num_slots - required_slots); i++) {
109114 free = 1;
....@@ -150,6 +155,11 @@
150155 return;
151156 }
152157
158
+ if (!dev->ishtp_dma_tx_map) {
159
+ dev_err(dev->devc, "Fail to allocate Tx map\n");
160
+ return;
161
+ }
162
+
153163 i = (msg_addr - dev->ishtp_host_dma_tx_buf) / DMA_SLOT_SIZE;
154164 spin_lock_irqsave(&dev->ishtp_dma_tx_lock, flags);
155165 for (j = 0; j < acked_slots; j++) {