All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Pavel Machek <pavel@ucw.cz>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dan Murphy <dmurphy@ti.com>, linux-leds@vger.kernel.org
Subject: Re: [PATCH v1] leds: Allow to call led_classdev_unregister() unconditionally
Date: Sun, 25 Aug 2019 12:51:45 +0200	[thread overview]
Message-ID: <fda837a7-fe16-ee73-cef9-ca94f686c031@gmail.com> (raw)
In-Reply-To: <6027ed85-62a2-8983-cd80-771b03dfd905@gmail.com>

On 8/16/19 8:02 PM, Jacek Anaszewski wrote:
> On 8/16/19 1:49 PM, Pavel Machek wrote:
>> Hi!
>>
>>> If in the certain driver the LED is optional, and it's a majority of them,
>>> the call of led_classdev_unregister() still requires some additional checks.
>>>
>>> The usual pattern on unregistering is to check for NULL, but we also check
>>> for IS_ERR() in case device_create_with_groups() fails.
>>>
>>> The change will reduce a burden in a lot of drivers to repeatedly check
>>> for above conditions.
>>
>> I don't see majority of calls being protected.  Doing nothing on NULL
>> sounds reasonable. I'm less sure about "IS_ERR"...
> 
> device_create_groups_vargs() returns ERR_PTR(retval) on error so
> led_cdev->dev may be left non-NULL even on error.
> 
> We can be correct checking only for NULL if we will add
> "led_cdev->dev = NULL" assignment in "if (IS_ERR(led_cdev->dev)" branch
> in led_classdev_register_ext(). Nonetheless I'm personally in favor of
> Andy's solution.
> 

Patch applied, thanks.

-- 
Best regards,
Jacek Anaszewski

      reply	other threads:[~2019-08-25 10:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 10:52 [PATCH v1] leds: Allow to call led_classdev_unregister() unconditionally Andy Shevchenko
2019-08-16 11:49 ` Pavel Machek
2019-08-16 13:31   ` Andy Shevchenko
2019-08-16 18:02   ` Jacek Anaszewski
2019-08-25 10:51     ` Jacek Anaszewski [this message]

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=fda837a7-fe16-ee73-cef9-ca94f686c031@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmurphy@ti.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.