ar71xx: fix invalid pointer dereference in c60_nand_scan_fixup()
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-c60.c
index 7b01af515b34dfce7d6271b56a72d68a249d20ed..144f5db740fee0159113c5ca7b9be103bc13829b 100644 (file)
@@ -180,7 +180,11 @@ static const struct mtd_ooblayout_ops c60_nand_ecclayout_ops = {
 
 static int c60_nand_scan_fixup(struct mtd_info *mtd)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
        struct nand_chip *chip = mtd->priv;
+#else
+       struct nand_chip *chip = mtd_to_nand(mtd);
+#endif
 
        chip->ecc.size = 512;
        chip->ecc.strength = 4;