diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2011-06-29 16:17:36 +0530 |
---|---|---|
committer | Manish Tuteja <mtuteja@nvidia.com> | 2011-07-11 02:41:18 -0700 |
commit | 6887d313f33745a4870a5c58cdffab1aa7d6f593 (patch) | |
tree | 193f59d7ce89394dc4ee8f31c6a98f1ea466ec42 /arch | |
parent | 25cf21ffec27c41b2c3b17d4d7ae340452950d20 (diff) |
arm: tegra: fuse: accept strings starting with 0x/x
some users might enter fuse data starting
with 0x/x. this will mess up the fuse programming.
do not consider 0x/x while programming the fuses.
also fix some compilation warnings
Reviewed-on: http://git-master/r/#change,38933
(cherry picked from commit fc8e1e492ac362a44ea6254759431d8f1fb1695c)
Bug 836963
Change-Id: If0503d4e22479e2ce230d53f538eea16d39817df
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/39614
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Manish Tuteja <mtuteja@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/tegra2_fuse.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/tegra2_fuse.c b/arch/arm/mach-tegra/tegra2_fuse.c index 872e6395e78f..028b984f1890 100644 --- a/arch/arm/mach-tegra/tegra2_fuse.c +++ b/arch/arm/mach-tegra/tegra2_fuse.c @@ -718,9 +718,6 @@ static ssize_t fuse_store(struct kobject *kobj, struct kobj_attribute *attr, return -EINVAL; } - if (!isxdigit(*buf)) - return -EINVAL; - if (fuse_odm_prod_mode()) { pr_err("%s: device locked. odm fuse already blown\n", __func__); return -EPERM; @@ -733,6 +730,15 @@ static ssize_t fuse_store(struct kobject *kobj, struct kobj_attribute *attr, return -EINVAL; } + /* see if the string has 0x/x at the start */ + if (*buf == 'x') { + count -= 1; + buf++; + } else if (*(buf + 1) == 'x') { + count -= 2; + buf += 2; + } + /* wakelock to avoid device powering down while programming */ wake_lock_init(&fuse_wk_lock, WAKE_LOCK_SUSPEND, "fuse_wk_lock"); wake_lock(&fuse_wk_lock); @@ -798,7 +804,7 @@ static ssize_t fuse_show(struct kobject *kobj, struct kobj_attribute *attr, char return ret; } - strcpy(buf, ""); + strcpy(buf, "0x"); for (i = (fuse_info_tbl[param].sz/sizeof(u32)) - 1; i >= 0 ; i--) { sprintf(str, "%08x", data[i]); strcat(buf, str); |