All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Crashing 'kzm' target in next-20160913 due to 'gpio: mxc: shift gpio_mxc_init() to subsys_initcall level'
Date: Tue, 13 Sep 2016 20:20:35 -0700	[thread overview]
Message-ID: <9befb559-499a-dd70-cd44-60d5fce2e5d6@roeck-us.net> (raw)

Hi Vladimir,

your commit e188cbf7564f ("gpio: mxc: shift gpio_mxc_init() to subsys_initcall level")
in -next causes the following crash when running the 'kzm' target (and most likely
the real thing) with qemu.

[    1.211426] Unable to handle kernel NULL pointer dereference at virtual address 0000000c
[    1.211600] pgd = c0004000
[    1.211680] [0000000c] *pgd=00000000
[    1.212067] Internal error: Oops: 5 [#1] SMP ARM
[    1.212245] Modules linked in:
[    1.212542] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc6-next-20160913 #1
[    1.212671] Hardware name: Kyoto Microcomputer Co., Ltd. KZM-ARM11-01
[    1.212825] task: c6848000 task.stack: c683e000
[    1.213231] PC is at platform_get_irq+0xc0/0xe8

See http://kerneltests.org/builders/qemu-arm-next/builds/525/steps/qemubuildcommand/logs/stdio
for a complete log.

Problem is quite subtle. The change causes the gpio driver to be installed later.
As a result, kzm_init_smsc9118() fails to initialize the gpio pins correctly.
gpio_request() in that function returns -EPROBE_DEFER, which is ignored,
gpio_to_irq() then returns -22 which is unconditionally assigned as interrupt number.
platform_get_irq(), as called from the smsc driver, gets this negative interrupt
number, and passes it unconditionally to irq_get_irq_data(), which returns NULL.
The NULL pointer is then passed to irqd_set_trigger_type() which, not entirely
surprisingly, crashes.

So, in other words, lots of bugs here. Nevertheless, I would suggest to keep using
postcore_initcall(), at least until it is sure that all gpio clients handle -EPROBE_DEFER
correctly.

Thanks,
Guenter

             reply	other threads:[~2016-09-14  3:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  3:20 Guenter Roeck [this message]
2016-09-14  7:19 ` Crashing 'kzm' target in next-20160913 due to 'gpio: mxc: shift gpio_mxc_init() to subsys_initcall level' Linus Walleij
2016-09-14 14:33   ` Guenter Roeck
2016-09-15 12:19     ` Linus Walleij
2016-09-15 13:18       ` Vladimir Zapolskiy
2016-09-15 13:45         ` Vladimir Zapolskiy
2016-09-15 13:55         ` Linus Walleij
2016-09-15 13:18   ` Vladimir Zapolskiy
2016-09-15 13:35 ` Vladimir Zapolskiy
2016-09-15 14:23   ` Uwe Kleine-König
2016-09-15 14:35     ` Guenter Roeck
2016-09-15 14:46       ` Uwe Kleine-König
2016-09-16  2:24         ` Guenter Roeck
2016-09-18  0:08   ` Shawn Guo
2016-09-18  0:59     ` Guenter Roeck
2016-09-18 11:24       ` Linus Walleij
2016-09-20 12:55         ` Shawn Guo
2016-09-20 13:53           ` Vladimir Zapolskiy
2016-09-20 14:18             ` Shawn Guo
2016-09-20 21:35           ` Linus Walleij

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=9befb559-499a-dd70-cd44-60d5fce2e5d6@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=vladimir_zapolskiy@mentor.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 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.