Attention is currently required from: Thomas Heijligen, Angel Pons, qianfan, Anastasia Klimchuk, Nicholas Chin.
Alexander Goncharov has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/70573 )
Change subject: ch347_spi.c: Add initial support for the WCH CH347 ......................................................................
Patch Set 4:
(11 comments)
Patchset:
PS4: Thank you so much for your work! I have just few comments.
File ch347_spi.c:
https://review.coreboot.org/c/flashrom/+/70573/comment/78d0f7b9_1b81bf18 PS4, Line 55: struct ch347_spi_data { : struct libusb_device_handle *handle; : }; Place this declaration before `devs_ch347_spi` variable.
https://review.coreboot.org/c/flashrom/+/70573/comment/c16eef57_e1a6991a PS4, Line 62: if (ch347_data->handle == NULL) : return -1; drop condition
https://review.coreboot.org/c/flashrom/+/70573/comment/5b62cb50_8ac45a05 PS4, Line 72: ch347_data->handle = NULL; in the next line of the code, we do `free(data)`, so there's no reason to care about this pointer
https://review.coreboot.org/c/flashrom/+/70573/comment/d996c3ac_9290667c PS4, Line 109: uint8_t buffer[CH347_PACKET_SIZE] = {0}; How about moving this variable to the rest of data? So the code will be after the data.
https://review.coreboot.org/c/flashrom/+/70573/comment/67230b02_a8440e57 PS4, Line 265: struct libusb_device_handle *handle = NULL; : struct ch347_spi_data *ch347_data = calloc(1, sizeof(*ch347_data)); As far as you allocate `ch347_spi_data` at the beginning of initialization, you can drop `struct libusb_device_handle *handle` variable.
https://review.coreboot.org/c/flashrom/+/70573/comment/56a7cc8d_4f36d55c PS4, Line 269: -1 Please, use `1` value just to be consistency with other initialization functions.
https://review.coreboot.org/c/flashrom/+/70573/comment/0f9739b2_345b5fa9 PS4, Line 275: -1 Same here, `1`
https://review.coreboot.org/c/flashrom/+/70573/comment/bce6fca4_e65d55ca PS4, Line 287: handle ch347_data->handle = ...;
https://review.coreboot.org/c/flashrom/+/70573/comment/4f8a3336_3e142fae PS4, Line 290: -1 Same here, `1`
https://review.coreboot.org/c/flashrom/+/70573/comment/71912292_99ca8a5d PS4, Line 335: -1 Same here, `1`