[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1437396110-5192-1-git-send-email-henryc.chen@mediatek.com>
Date: Mon, 20 Jul 2015 20:41:50 +0800
From: Henry Chen <henryc.chen@...iatek.com>
To: Mark Brown <broonie@...nel.org>
CC: Matthias Brugger <matthias.bgg@...il.com>,
Sascha Hauer <kernel@...gutronix.de>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <henryc.chen@...iatek.com>,
<eddie.huang@...iatek.com>
Subject: [PATCH] regmap: Add function check before called format_val
The regmap_format will not be initialize since regmap_bus is not assgined
on regmap_init(). It should has a function check before using
format_val() to avoid null function called on regmap_bulk_read().
Signed-off-by: Henry Chen <henryc.chen@...iatek.com>
---
Based on v4.2rc1
---
drivers/base/regmap/regmap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 7111d04..c1e8c32 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2317,7 +2317,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
&ival);
if (ret != 0)
return ret;
- map->format.format_val(val + (i * val_bytes), ival, 0);
+ if (map->format.format_val)
+ map->format.format_val(val + (i * val_bytes), ival, 0);
+ else
+ memcpy(val + (i * val_bytes), &ival, val_bytes);
}
}
--
1.8.1.1.dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists