summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/patches-3.6/a05-ar934x_nfc-add-buffer-verification.patch
blob: 55c9da119e636aeb0b45c95f72393b82dda10813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- a/drivers/mtd/nand/ar934x_nfc.c
+++ b/drivers/mtd/nand/ar934x_nfc.c
@@ -762,6 +762,18 @@ ar934x_nfc_read_buf(struct mtd_info *mtd
 	nfc->buf_index = buf_index;
 }
 
+static int
+ar934x_nfc_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
+{
+	int i;
+
+	for (i = 0; i < len; i++)
+		if (buf[i] != ar934x_nfc_read_byte(mtd))
+			return -EFAULT;
+
+	return 0;
+}
+
 static void
 ar934x_nfc_hw_init(struct ar934x_nfc *nfc)
 {
@@ -1047,6 +1059,7 @@ ar934x_nfc_probe(struct platform_device
 	nand->read_byte = ar934x_nfc_read_byte;
 	nand->write_buf = ar934x_nfc_write_buf;
 	nand->read_buf = ar934x_nfc_read_buf;
+	nand->verify_buf = ar934x_nfc_verify_buf;
 	nand->select_chip = ar934x_nfc_select_chip;
 
 	ret = ar934x_nfc_alloc_buf(nfc, AR934X_NFC_ID_BUF_SIZE);