Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] pwm: core: use device_match_name() instead of strcmp(dev_name(...
Date: Fri, 25 Oct 2024 16:04:19 +0300	[thread overview]
Message-ID: <ZxuXU3nTuEwoTFiH@smile.fi.intel.com> (raw)
In-Reply-To: <2r7ey7fkt4k3s3kpi2vmesqrfntyd6jt7uf5jmwwbzglgxcohf@lr5gfy3ce2yu>

On Thu, Oct 24, 2024 at 10:55:36PM +0200, Uwe Kleine-König wrote:
> On Thu, Oct 24, 2024 at 06:19:05PM +0300, Andy Shevchenko wrote:

...

> >  	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? 

Please, tell me how
(looking at the of device_add() and kobject_set_name_vargs() implementations)?

Btw, have you ever seen this check somewhere else? (I don't, but I haven't
covered full kernel sources, of course.)

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-10-25 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 15:19 [PATCH v1 1/1] pwm: core: use device_match_name() instead of strcmp(dev_name( Andy Shevchenko
2024-10-24 20:55 ` Uwe Kleine-König
2024-10-25 13:04   ` Andy Shevchenko [this message]
2024-10-25 14:17     ` Uwe Kleine-König
2024-10-25 14:23       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZxuXU3nTuEwoTFiH@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox