Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b542a13 authored by Ben Dooks's avatar Ben Dooks
Browse files

ARM: S3C: Fix NAND device registration by s3c_nand_set_platdata().



Fix two bugs in s3c_nand_set_platdata() where thet device's platform
data was not set, and the wrong error check was being performed on
the return of s3c_nand_copy_set().

Fixes the following OOPS:

Unable to handle kernel NULL pointer dereference at virtual address 00000004
PC is at s3c24xx_nand_probe+0x234/0x594

Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent ce8877b5
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -114,7 +114,7 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
		
		
		for (i = 0; i < npd->nr_sets; i++) {
		for (i = 0; i < npd->nr_sets; i++) {
			ret = s3c_nand_copy_set(to);
			ret = s3c_nand_copy_set(to);
			if (!ret) {
			if (ret) {
				printk(KERN_ERR "%s: failed to copy set %d\n",
				printk(KERN_ERR "%s: failed to copy set %d\n",
				__func__, i);
				__func__, i);
				return;
				return;
@@ -122,6 +122,8 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
			to++;
			to++;
		}
		}
	}
	}

	s3c_device_nand.dev.platform_data = npd;
}
}


EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);