drivers: Simplify libusb_alloc_transfer(0) calls

By using our new, never-failing, USB allocation wrapper. As it can never
fail, we can also remove all the error paths for the allocations
failing.
This commit is contained in:
Bastien Nocera
2018-09-19 17:06:17 +02:00
parent bdba9990fb
commit 10ae8ffb55
18 changed files with 74 additions and 325 deletions

View File

@@ -24,9 +24,9 @@
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include <glib.h>
#include "fpi-usb.h"
#include "assembling.h"
#include "aeslib.h"
@@ -73,14 +73,9 @@ static int do_write_regv(struct write_regv_data *wdata, int upper_bound)
unsigned char *data = g_malloc(alloc_size);
unsigned int i;
size_t data_offset = 0;
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
struct libusb_transfer *transfer = fpi_usb_alloc();
int r;
if (!transfer) {
g_free(data);
return -ENOMEM;
}
for (i = offset; i < offset + num; i++) {
const struct aes_regwrite *regwrite = &wdata->regs[i];
data[data_offset++] = regwrite->reg;