From: Michael Gernoth Date: Sun, 5 Jun 2016 17:23:32 +0000 (+0200) Subject: hmuartlgw: simplify crc check X-Git-Tag: v0.103~6 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/commitdiff_plain/b1d2ccc2e0f45169d6dda672c80a5aaf4770e7a3?ds=inline;hp=9248b988ecacab0249a1e957d1221143454d00f1 hmuartlgw: simplify crc check --- diff --git a/hmuartlgw.c b/hmuartlgw.c index 2e6757a..4c274cf 100644 --- a/hmuartlgw.c +++ b/hmuartlgw.c @@ -413,10 +413,8 @@ int hmuartlgw_poll(struct hmuartlgw_dev *dev, int timeout) return -1; } - crc = crc16(dev->buf, dev->pos - 2); - if ((((crc >> 8) & 0xff) == dev->buf[dev->pos - 2]) && - ((crc & 0xff) == dev->buf[dev->pos - 1])) { - + crc = crc16(dev->buf, dev->pos); + if (crc == 0x0000) { if (debug) hexdump(dev->buf, dev->pos, "UARTLGW > ");