summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2020-07-03 12:33:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-29 10:18:37 +0200
commit01d7bd8903d877f0234e567ceba671161ceee5ae (patch)
treeae3247b9f00650e5b0f907bdb29acb51c64ff0f4 /drivers/base
parentbbc0b6e1840544dc436b3d6684c129b8e33a108d (diff)
downloadlinux-rt-01d7bd8903d877f0234e567ceba671161ceee5ae.tar.gz
regmap: dev_get_regmap_match(): fix string comparison
[ Upstream commit e84861fec32dee8a2e62bbaa52cded6b05a2a456 ] This function is used by dev_get_regmap() to retrieve a regmap for the specified device. If the device has more than one regmap, the name parameter can be used to specify one. The code here uses a pointer comparison to check for equal strings. This however will probably always fail, as the regmap->name is allocated via kstrdup_const() from the regmap's config->name. Fix this by using strcmp() instead. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Link: https://lore.kernel.org/r/20200703103315.267996-1-mkl@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 320d23de02c2..927ebde1607b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1363,7 +1363,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)
/* If the user didn't specify a name match any */
if (data)
- return (*r)->name == data;
+ return !strcmp((*r)->name, data);
else
return 1;
}