summaryrefslogtreecommitdiff
path: root/recipes/u-boot/u-boot-git/beagleboard/0016-env_nand.c-fail-gracefully-if-no-nand-is-present.patch
blob: 5e83125e354bd040919a009434c2c30d069a8117 (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
From 794e4aa6a5aa5fbe71b08bfe8f5f5f65078fbc68 Mon Sep 17 00:00:00 2001
From: Steve Sakoman <steve@sakoman.com>
Date: Tue, 23 Mar 2010 09:12:16 -0700
Subject: [PATCH 16/37] env_nand.c:  fail gracefully if no nand is present

---
 common/env_nand.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/common/env_nand.c b/common/env_nand.c
index a15a950..325f112 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -268,6 +268,10 @@ int readenv (size_t offset, u_char * buf)
 
 	u_char *char_ptr;
 
+	/* fail if no nand detected */
+	if (nand_info[0].type == 0)
+		return 1;
+
 	blocksize = nand_info[0].erasesize;
 	len = min(blocksize, CONFIG_ENV_SIZE);
 
-- 
1.6.6.1