diff options
author | Pankaj Dubey <pankaj.dubey@samsung.com> | 2014-09-27 09:47:55 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-30 09:35:10 -0700 |
commit | a110e6d6ebac622c30c9d219b5b154d3d3167a20 (patch) | |
tree | 906285b12140501352c9eed372cfca633ce5b314 /drivers/base | |
parent | d9aa4aecb2e94ca383789147769291e8723ecf86 (diff) | |
download | linux-3.10-a110e6d6ebac622c30c9d219b5b154d3d3167a20.tar.gz linux-3.10-a110e6d6ebac622c30c9d219b5b154d3d3167a20.tar.bz2 linux-3.10-a110e6d6ebac622c30c9d219b5b154d3d3167a20.zip |
regmap: fix NULL pointer dereference in _regmap_write/read
commit 5336be8416a71b5568d2cf54a2f2066abe9f2a53 upstream.
If LOG_DEVICE is defined and map->dev is NULL it will lead to NULL
pointer dereference. This patch fixes this issue by adding check for
dev->NULL in all such places in regmap.c
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 4b5cf2e34e9..6a66f0b7d3d 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1177,7 +1177,7 @@ int _regmap_write(struct regmap *map, unsigned int reg, } #ifdef LOG_DEVICE - if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) + if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0) dev_info(map->dev, "%x <= %x\n", reg, val); #endif @@ -1437,7 +1437,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, ret = map->reg_read(context, reg, val); if (ret == 0) { #ifdef LOG_DEVICE - if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) + if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0) dev_info(map->dev, "%x => %x\n", reg, *val); #endif |