| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ISHTP DMA I/F functions |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2003-2016, Intel Corporation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 8 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | | - * |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 113 | 104 | int required_slots = (size / DMA_SLOT_SIZE) |
|---|
| 114 | 105 | + 1 * (size % DMA_SLOT_SIZE != 0); |
|---|
| 115 | 106 | |
|---|
| 107 | + if (!dev->ishtp_dma_tx_map) { |
|---|
| 108 | + dev_err(dev->devc, "Fail to allocate Tx map\n"); |
|---|
| 109 | + return NULL; |
|---|
| 110 | + } |
|---|
| 111 | + |
|---|
| 116 | 112 | spin_lock_irqsave(&dev->ishtp_dma_tx_lock, flags); |
|---|
| 117 | 113 | for (i = 0; i <= (dev->ishtp_dma_num_slots - required_slots); i++) { |
|---|
| 118 | 114 | free = 1; |
|---|
| .. | .. |
|---|
| 159 | 155 | return; |
|---|
| 160 | 156 | } |
|---|
| 161 | 157 | |
|---|
| 158 | + if (!dev->ishtp_dma_tx_map) { |
|---|
| 159 | + dev_err(dev->devc, "Fail to allocate Tx map\n"); |
|---|
| 160 | + return; |
|---|
| 161 | + } |
|---|
| 162 | + |
|---|
| 162 | 163 | i = (msg_addr - dev->ishtp_host_dma_tx_buf) / DMA_SLOT_SIZE; |
|---|
| 163 | 164 | spin_lock_irqsave(&dev->ishtp_dma_tx_lock, flags); |
|---|
| 164 | 165 | for (j = 0; j < acked_slots; j++) { |
|---|