linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Alexandru Ardelean <aardelean@deviqon.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	bgolaszewski@baylibre.com, linus.walleij@linaro.org,
	sathyanarayanan.kuppuswamy@linux.intel.com, andy@kernel.org
Subject: Re: [PATCH] gpio: wcove: remove platform_set_drvdata() + cleanup probe
Date: Wed, 7 Jul 2021 17:08:52 +0300	[thread overview]
Message-ID: <YOW1dKIpXa1GXyXh@smile.fi.intel.com> (raw)
In-Reply-To: <20210707135226.191988-1-aardelean@deviqon.com>

On Wed, Jul 07, 2021 at 04:52:26PM +0300, Alexandru Ardelean wrote:
> The platform_set_drvdata() call is only useful if we need to retrieve back
> the private information.
> Since the driver doesn't do that, it's not useful to have it.

This is fine.

> This change also changes the probe order a bit, moving the
> devm_gpiochip_add_data() as the last call. This means that when the
> gpiochip is registered [and available to consumers], it should be
> initialized.
> 
> It's still possible that the devm_gpiochip_add_data() call could fail,
> leaving the chip in a partially initialized state, but that was possible
> even before this change; it was just some other partially initialized
> state.

...

>  	/* Enable GPIO0 interrupts */

^^^^^

> +	return devm_gpiochip_add_data(dev, &wg->chip, wg);

This is dangerous change. How did you test it?

The handler now can be called before chip and actual handling code is
registered. It means at least two possible (bad) scenarios:
 1) the handler may dereference dangling or NULL pointer;
 2) the IRQ may be level interrupt and we may got 100000 IRQs and
    IRQ core will disable it leaving device completely unfunctional.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-07-07 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 13:52 [PATCH] gpio: wcove: remove platform_set_drvdata() + cleanup probe Alexandru Ardelean
2021-07-07 14:08 ` Andy Shevchenko [this message]
2021-07-08  7:03   ` Alexandru Ardelean

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=YOW1dKIpXa1GXyXh@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=aardelean@deviqon.com \
    --cc=andy@kernel.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.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;
as well as URLs for NNTP newsgroup(s).