linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Colin Pitrat <colin.pitrat@gmail.com>
Cc: linus.walleij@linaro.org, gnurou@gmail.com,
	rebecca.swee.fun.chang@intel.com, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpio: sch: Fix Oops on module load on Asus Eee PC 1201
Date: Mon, 9 May 2016 10:02:45 +0300	[thread overview]
Message-ID: <20160509070245.GJ15974@lahna.fi.intel.com> (raw)
In-Reply-To: <20160506214917.GA1691@pitrat4.localdomain>

On Fri, May 06, 2016 at 10:49:25PM +0100, Colin Pitrat wrote:
> This fixes the issue descirbe in bug 117531. 

Can you include the oops log in the changelog as well?

> It's a regression introduced in linux 4.5 that causes a Oops at load of
> gpio_sch and prevents powering off the computer.
> 
> The patch consist in reverting commit 737c8fccf1c5b2aae3c6d9a66dce17e35fc39b71 
> (a.k.a 'gpio: sch: use gpiochip data pointer') that causes this regression.
> However, although it does work for me, I'm not sure of the impact of reverting
> only this part of the patch.

What happens here is that after the change we expect that
gpiochip_get_data() returns the correct pointer but that only happens
after devm_gpiochip_add_data() is called, which is the last call in
sch_gpio_probe(). Before that we call sch_gpio_reg_set() couple of times
if the device id is PCI_DEVICE_ID_INTEL_SCH_LPC and that causes NULL
pointer dereference.

I think better fix is to make sch_gpio_reg_get() and sch_gpio_reg_set()
take pointer to struct sch_gpio and use that directly like:

static void sch_gpio_reg_set(struct sch_gpio *sch, unsigned gpio,
			     unsigned reg, int val)
{
	...
}

Neither function actually need gc for anything anyway.

  parent reply	other threads:[~2016-05-09  7:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 21:49 [PATCH] gpio: sch: Fix Oops on module load on Asus Eee PC 1201 Colin Pitrat
2016-05-07 19:37 ` Colin Pitrat
2016-05-09  7:02 ` Mika Westerberg [this message]
2016-05-09 19:37   ` Colin Pitrat
     [not found]     ` <CABy3NjSJTygdP3POxQQqxDA6=Jx4DeQ47KONASfm46kei7wBDQ@mail.gmail.com>
2016-06-17  8:10       ` Mika Westerberg

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=20160509070245.GJ15974@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=colin.pitrat@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rebecca.swee.fun.chang@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).