Skip to content

Commit fdb6292

Browse files
andy-shevUwe Kleine-König
authored andcommitted
pwm: core: use device_match_name() instead of strcmp(dev_name(...
Use the dedicated helper for comparing device names against strings. Note, the current code has a check for the dev_name() against NULL. With the current implementations of the device_add() and dev_set_name() it most likely a theoretical assumption that that might happen, while I don't see how. Hence, that check has simply been removed. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20241025142704.405340-1-andriy.shevchenko@linux.intel.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
1 parent 664b5e4 commit fdb6292

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/pwm/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,7 @@ static struct pwm_chip *pwmchip_find_by_name(const char *name)
852852
guard(mutex)(&pwm_lock);
853853

854854
idr_for_each_entry_ul(&pwm_chips, chip, tmp, id) {
855-
const char *chip_name = dev_name(pwmchip_parent(chip));
856-
857-
if (chip_name && strcmp(chip_name, name) == 0)
855+
if (device_match_name(pwmchip_parent(chip), name))
858856
return chip;
859857
}
860858

0 commit comments

Comments
 (0)