Skip to content

Commit e84861f

Browse files
marckleinebuddebroonie
authored andcommitted
regmap: dev_get_regmap_match(): fix string comparison
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>
1 parent 95b2c3e commit e84861f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/base/regmap/regmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)
13641364

13651365
/* If the user didn't specify a name match any */
13661366
if (data)
1367-
return (*r)->name == data;
1367+
return !strcmp((*r)->name, data);
13681368
else
13691369
return 1;
13701370
}

0 commit comments

Comments
 (0)