Skip to content

Commit

Permalink
pwm: pxa: Use module_platform_driver
Browse files Browse the repository at this point in the history
Commit 76abbdd

    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>
  • Loading branch information
Mike Dunn authored and Thierry Reding committed Sep 3, 2013
1 parent ac872bc commit 1e185c7
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions drivers/pwm/pwm-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,6 @@ static struct platform_driver pwm_driver = {
.id_table = pwm_id_table,
};

static int __init pwm_init(void)
{
return platform_driver_register(&pwm_driver);
}
arch_initcall(pwm_init);

static void __exit pwm_exit(void)
{
platform_driver_unregister(&pwm_driver);
}
module_exit(pwm_exit);
module_platform_driver(pwm_driver);

MODULE_LICENSE("GPL v2");

0 comments on commit 1e185c7

Please sign in to comment.