* Allocate memory with alignment. * * @param size * Memory size to be allocated. * @param align * Memory alignment. * @param zero * Clear the allocated memory or not. * * @return * Pointer of the allocated memory, NULL otherwise. */
| 146 | * Pointer of the allocated memory, NULL otherwise. |
| 147 | */ |
| 148 | static void * |
| 149 | mlx5_alloc_align(size_t size, unsigned int align, unsigned int zero) |
| 150 | { |
| 151 | void *buf; |
| 152 | |
| 153 | buf = mlx5_os_malloc(align, size); |
| 154 | if (!buf) { |
| 155 | DRV_LOG(ERR, "Couldn't allocate buf size=%zu align=%u.", |
| 156 | size, align); |
| 157 | return NULL; |
| 158 | } |
| 159 | if (zero) |
| 160 | memset(buf, 0, size); |
| 161 | return buf; |
| 162 | } |
| 163 | |
| 164 | void * |
| 165 | mlx5_malloc(uint32_t flags, size_t size, unsigned int align, int socket) |
no test coverage detected