提交 17649c90 编写于 作者: S Sergey SENOZHATSKY 提交者: Mark Brown

regmap: fix a NULL pointer dereference in __regmap_init

__regmap_init() may receive a NULL `struct regmap_bus *bus' pointer,
for example, from snd_hdac_regmap_init(), and it make sure that it
does not NULL deference `bus`, except around ->max_raw_read and
->max_raw_write initialisation. Add missing check.
Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 29332534
...@@ -579,8 +579,10 @@ struct regmap *regmap_init(struct device *dev, ...@@ -579,8 +579,10 @@ struct regmap *regmap_init(struct device *dev,
map->use_single_read = config->use_single_rw || !bus || !bus->read; map->use_single_read = config->use_single_rw || !bus || !bus->read;
map->use_single_write = config->use_single_rw || !bus || !bus->write; map->use_single_write = config->use_single_rw || !bus || !bus->write;
map->can_multi_write = config->can_multi_write && bus && bus->write; map->can_multi_write = config->can_multi_write && bus && bus->write;
map->max_raw_read = bus->max_raw_read; if (bus) {
map->max_raw_write = bus->max_raw_write; map->max_raw_read = bus->max_raw_read;
map->max_raw_write = bus->max_raw_write;
}
map->dev = dev; map->dev = dev;
map->bus = bus; map->bus = bus;
map->bus_context = bus_context; map->bus_context = bus_context;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册