From: Benjamin Larsson Date: Sun, 15 Mar 2015 22:57:51 +0000 (-0300) Subject: [media] mn88472: implement firmware parity check X-Git-Tag: v4.1-rc1~59^2~1^2~130 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=307e95c92257;p=karo-tx-linux.git [media] mn88472: implement firmware parity check Signed-off-by: Benjamin Larsson Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/mn88472/mn88472.c b/drivers/staging/media/mn88472/mn88472.c index 6f0cac44d273..85ef4f694c8b 100644 --- a/drivers/staging/media/mn88472/mn88472.c +++ b/drivers/staging/media/mn88472/mn88472.c @@ -258,6 +258,7 @@ static int mn88472_init(struct dvb_frontend *fe) int ret, len, remaining; const struct firmware *fw = NULL; u8 *fw_file = MN88472_FIRMWARE; + unsigned int csum; dev_dbg(&client->dev, "\n"); @@ -303,6 +304,20 @@ static int mn88472_init(struct dvb_frontend *fe) } } + /* parity check of firmware */ + ret = regmap_read(dev->regmap[0], 0xf8, &csum); + if (ret) { + dev_err(&client->dev, + "parity reg read failed=%d\n", ret); + goto err; + } + if (csum & 0x10) { + dev_err(&client->dev, + "firmware parity check failed=0x%x\n", csum); + goto err; + } + dev_err(&client->dev, "firmware parity check succeeded=0x%x\n", csum); + ret = regmap_write(dev->regmap[0], 0xf5, 0x00); if (ret) goto firmware_release;