+ if (cfg_info.build != data->info.build)
+ dev_err(dev, "Warning: build num mismatch!\n");
+
+ ret = sscanf(cfg->data + pos, "%x%n", &info_crc, &offset);
+ if (ret != 1) {
+ dev_err(dev, "Bad format: failed to parse Info CRC\n");
+ ret = -EINVAL;
+ goto release;
+ }
+ pos += offset;
+
+ /* Check config CRC */
+ ret = sscanf(cfg->data + pos, "%x%n", &config_crc, &offset);
+ if (ret != 1) {
+ dev_err(dev, "Bad format: failed to parse Config CRC\n");
+ ret = -EINVAL;
+ goto release;
+ }
+ pos += offset;
+
+ if (data->config_crc == config_crc) {
+ dev_dbg(dev, "Config CRC 0x%06X: OK\n", config_crc);
+ ret = 0;
+ goto release;
+ }
+
+ dev_info(dev, "Config CRC 0x%06X: does not match file 0x%06X\n",
+ data->config_crc, config_crc);
+
+ while (pos < cfg->size) {
+ /* Read type, instance, length */
+ ret = sscanf(cfg->data + pos, "%x %x %x%n",
+ &type, &instance, &size, &offset);
+ if (ret == 0) {
+ /* EOF */
+ ret = 1;
+ goto release;
+ } else if (ret != 3) {
+ dev_err(dev, "Bad format: failed to parse object\n");
+ ret = -EINVAL;
+ goto release;
+ }
+ pos += offset;
+
+ object = mxt_get_object(data, type);
+ if (!object) {
+ /* Skip object */
+ for (i = 0; i < size; i++) {
+ ret = sscanf(cfg->data + pos, "%hhx%n",
+ &val,
+ &offset);
+ pos += offset;
+ }