dcc92eeecfb2bf532021560b2b221b3be7cfe6fd
[openwrt.git] / target / linux / brcm63xx / patches-2.6.25 / 110-bcm963xx_fix_cfe_detection.patch
1 From f1a605c36cf1659f5f486ae4135de1e285fdf86c Mon Sep 17 00:00:00 2001
2 From: Axel Gembe <ago@bastart.eu.org>
3 Date: Sat, 17 May 2008 16:17:22 +0200
4 Subject: [PATCH] bcm963xx: fix cfe detection
5
6 The CFE detection failed to account for zero termination.
7
8 Signed-off-by: Axel Gembe <ago@bastart.eu.org>
9 ---
10  drivers/mtd/maps/bcm963xx-flash.c |   11 ++++++-----
11  1 files changed, 6 insertions(+), 5 deletions(-)
12
13 diff --git a/drivers/mtd/maps/bcm963xx-flash.c b/drivers/mtd/maps/bcm963xx-flash.c
14 index c4c4526..4da672b 100644
15 --- a/drivers/mtd/maps/bcm963xx-flash.c
16 +++ b/drivers/mtd/maps/bcm963xx-flash.c
17 @@ -1,8 +1,7 @@
18  /*
19 - * $Id$
20   * Copyright (C) 2006  Florian Fainelli <florian@openwrt.org>
21 - *                     Mike Albon <malbon@openwrt.org>
22 - * Copyright (C) $Date$  $Author$
23 + *                     Mike Albon <malbon@openwrt.org>
24 + * Copyright (C) 2008  Axel Gembe <ago@bastart.eu.org>
25   *
26   * This program is free software; you can redistribute it and/or modify
27   * it under the terms of the GNU General Public License as published by
28 @@ -184,11 +183,13 @@ static int bcm963xx_parts_size = sizeof(bcm963xx_parts) / sizeof(bcm963xx_parts[
29  static int bcm963xx_detect_cfe(struct mtd_info *master)
30  {
31         int idoffset = 0x4e0;
32 -       static char idstring[8] = "CFE1CFE1";
33 -       char buf[8];
34 +       static char idstring[9] = "CFE1CFE1";
35 +       char buf[9];
36         int ret;
37         size_t retlen;
38  
39 +       memset(buf, 0, sizeof(buf));
40 +
41         ret = master->read(master, idoffset, 8, &retlen, (void *)buf);
42         printk("bcm963xx: Read Signature value of %s\n", buf);
43         return strcmp(idstring,buf);
44 -- 
45 1.5.5.1
46