From: Andy Shevchenko Date: Fri, 25 Oct 2024 14:26:34 +0000 (+0300) Subject: pwm: core: use device_match_name() instead of strcmp(dev_name(... X-Git-Tag: v6.13-rc1~157^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fdb62922ae89c17963f80abdd14b4d9f053bc962;p=thirdparty%2Fkernel%2Flinux.git 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 Link: https://lore.kernel.org/r/20241025142704.405340-1-andriy.shevchenko@linux.intel.com Signed-off-by: Uwe Kleine-König --- diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 634be56e204b2..4399e793efaf4 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -852,9 +852,7 @@ static struct pwm_chip *pwmchip_find_by_name(const char *name) guard(mutex)(&pwm_lock); idr_for_each_entry_ul(&pwm_chips, chip, tmp, id) { - const char *chip_name = dev_name(pwmchip_parent(chip)); - - if (chip_name && strcmp(chip_name, name) == 0) + if (device_match_name(pwmchip_parent(chip), name)) return chip; }