regmap: dev_get_regmap_match(): fix string comparison
authorMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 3 Jul 2020 10:33:15 +0000 (12:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 08:19:51 +0000 (10:19 +0200)
commit2da0320bfcbd5a05231549239a53aca4f84301eb
treeaa0aa9dc817a06346de5f2e9a403bff043bfcee2
parent6bfef2983be3cdfe7612ad239f85764ad457a3ea
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>
drivers/base/regmap/regmap.c