- /*
- * Perform crc validation on the firmware.
- * The last 2 bytes in the firmware array are the crc checksum itself,
- * this means that we should never pass those 2 bytes to the crc
- * algorithm.
- */
- if (test_bit(DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, &rt2x00dev->flags)) {
- /*
- * Use the crc itu-t algorithm.
- * Use 0 for the last 2 bytes to complete the checksum.
- */
- crc = crc_itu_t(0, fw->data, fw->size - 2);
- crc = crc_itu_t_byte(crc, 0);
- crc = crc_itu_t_byte(crc, 0);
- } else if (test_bit(DRIVER_REQUIRE_FIRMWARE_CCITT, &rt2x00dev->flags)) {
- /*
- * Use the crc ccitt algorithm.
- * This will return the same value as the legacy driver which
- * used bit ordering reversion on the both the firmware bytes
- * before input input as well as on the final output.
- * Obviously using crc ccitt directly is much more efficient.
- */
- crc = crc_ccitt(~0, fw->data, fw->size - 2);
- } else {
- ERROR(rt2x00dev, "No checksum algorithm selected "
- "for firmware validation.\n");
- retval = -ENOENT;
- goto exit;
- }
-