diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2011-06-29 16:17:36 +0530 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2011-07-14 13:19:25 -0700 |
commit | 88a28ab7b20d5eec70e9d0a335952ba0904d9b7e (patch) | |
tree | 74dbd319f2adfe68d6fd7ab1e46539faa1808fb7 /arch | |
parent | 59085dfe2b78d61071919ce0a5460af25ee78f75 (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
Change-Id: I5e888a769eb15dbe7eb35ce2d290246fcf9788c9
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/38933
Reviewed-by: Bharat Nihalani <bnihalani@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 e62a3357dd85..7934b5104343 100644 --- a/arch/arm/mach-tegra/tegra2_fuse.c +++ b/arch/arm/mach-tegra/tegra2_fuse.c @@ -722,9 +722,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; @@ -737,6 +734,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); @@ -812,7 +818,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); |