Re: [PATCH v4] hwmon: (corsair-cpro) Add firmware and bootloader information

From: Guenter Roeck
Date: Mon May 13 2024 - 15:37:37 EST


On Mon, May 13, 2024 at 09:25:38PM +0200, Marius Zachmann wrote:
[ ...]
>
> +/* read firmware version */
> +static int get_fw_version(struct ccp_device *ccp)
> +{
> + int ret;
> +
> + ret = send_usb_cmd(ccp, CTL_GET_FW_VER, 0, 0, 0);
> + if (ret) {
> + hid_notice(ccp->hdev, "Failed to read firmware version.\n");

Please use the following pattern:

if (ret) {
hid_notice(ccp->hdev, "Failed to read firmware version.\n");
return ret;
}
ccp->firmware_ver[0] = ccp->buffer[1];
ccp->firmware_ver[1] = ccp->buffer[2];
ccp->firmware_ver[2] = ccp->buffer[3];

return 0;

Thanks,
Guenter