]> git.baikalelectronics.ru Git - kernel.git/commit
pwm: pxa: Use module_platform_driver
authorMike Dunn <mikedunn@newsguy.com>
Thu, 8 Aug 2013 17:00:37 +0000 (10:00 -0700)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 3 Sep 2013 11:09:17 +0000 (13:09 +0200)
commitb71cbbd40471b2d57928ac5d0bab8ff225233052
tree802a9dd5436b907cb78355599674ac7e085d620a
parent827ddfc6ba5ec7a7fabe0c0cc3b8154a5fdcace7
pwm: pxa: Use module_platform_driver

Commit 9186687a60a7220e715901d5ae86b85034adc34c

    pwm: Add sysfs interface

causes a kernel oops due to a null pointer dereference on PXA platforms.
This happens because the class added by the patch is registered in a
subsys_initcall (initcall4), but the pxa pwm driver is registered in
arch_initcall (initcall3). If the class is not registered before the
driver probe function runs, the oops occurs in device_add() when the
uninitialized pointers in struct class are dereferenced.  I don't see a
reason that the driver must be an arch_initcall, so this patch makes it
a regular module_platform_driver (initcall6), preventing the oops.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-pxa.c