summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2011-07-14 15:11:51 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:47:39 -0800
commit0f4c94256fb69188efad81873f4198de7914aee2 (patch)
treedaa93dd11fd70fd5f462e4bb92a85b1b8601abaf
parentc2b8df3202e9e5130b3c54546350db69a7e9b4b3 (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 Original-Change-Id: I36b525c71b6d5c437affbaf0724667f8e5984aa6 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/41016 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: Rb6a134adfa8049865bb4154353763d43f743e052
-rw-r--r--arch/arm/mach-tegra/tegra_odm_fuses.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/tegra_odm_fuses.c b/arch/arm/mach-tegra/tegra_odm_fuses.c
index 9cd7aa86a224..96f69f4b0458 100644
--- a/arch/arm/mach-tegra/tegra_odm_fuses.c
+++ b/arch/arm/mach-tegra/tegra_odm_fuses.c
@@ -758,9 +758,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;
@@ -773,6 +770,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;
+ }
+
/* we need to fit each character into a single nibble */
raw_byte_data += DIV_ROUND_UP(count, 2) - 1;
@@ -842,7 +848,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);