On Thu, Jul 23, 2015 at 01:39:06PM +0300, Sergei Shtylyov wrote: > Hello. > > On 7/22/2015 9:56 PM, Peter E. Berger wrote: > > @@ -928,6 +928,41 @@ static int ti_cpu_rev(struct edge_ti_manuf_descriptor *desc) > > return TI_GET_CPU_REVISION(desc->CpuRev_BoardRev); > > } > > > > +static int check_fw_sanity(struct edgeport_serial *serial, > > + const struct firmware *fw) > > +{ > > + u16 length_total; > > + int checksum = 0; > > + int pos; > > + struct device *dev = &serial->serial->interface->dev; > > + struct edgeport_fw_hdr *fw_hdr = (struct edgeport_fw_hdr *)fw->data; > > + > > + if (fw->size < sizeof(struct edgeport_fw_hdr)) { > > + dev_err(dev, "Incomplete fw header\n"); > > + return -EINVAL; > > + } > > + > > + length_total = le16_to_cpu(fw_hdr->length) + > > + sizeof(struct edgeport_fw_hdr); > > + > > + if (fw->size != length_total) { > > + dev_err(dev, "Bad fw size (Expected: %u, Got: %zu)\n", > > I would not capitalize the latter 2 words. I wouldn't either; just use lower case for the whole message. > > + length_total, fw->size); > > + return -EINVAL; > > + } > > + > > + for (pos = sizeof(struct edgeport_fw_hdr); pos < fw->size; ++pos) > > + checksum = (checksum + fw->data[pos]) & 0xFF; > > Why not make 'checksum' 's8' or 'u8' instead of *int*? I'd prefer that as well. > > + > > + if (checksum != fw_hdr->checksum) { > > + dev_err(dev, "Bad fw checksum (Expected: 0x%x, Got: 0x%x)\n", > > + fw_hdr->checksum, checksum); > > I would not capitalize the latter 2 words. Please use all lower case. Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html