Re: [PATCH v1 1/1] pwm: core: use device_match_name() instead of strcmp(dev_name(...
From: Uwe Kleine-König
Date: Thu Oct 24 2024 - 16:55:51 EST
Hello Andy,
On Thu, Oct 24, 2024 at 06:19:05PM +0300, Andy Shevchenko wrote:
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index 634be56e204b..4399e793efaf 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))
This theoretically changes behaviour in a few cases. For example if
dev_name(pwmchip_parent(chip)) is NULL the new code would crash. Can
this happen?
Best regards
Uwe
> return chip;
> }
Attachment:
signature.asc
Description: PGP signature