CLK: TI: consider the fact that of_clk_get() might return an error
Subsystems (2)
PATCH 1/1 CLK: TI: consider the fact that of_clk_get() might return an error
I "forgot" to update the dtb and the kernel crashed:
|Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8
because I did not have the clock nodes. of_clk_get() returns an error pointer which is not checked here.
--- drivers/clk/ti/clockdomain.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/ti/clockdomain.c +5 -0
@@ -36,6 +36,11 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)for (i =0 ; i < num_clks; i++) { clk =of_clk_get (node, i); +if (IS_ERR (clk)) { +pr_err ("Failed get %s' clock nr %d (%ld)\n" , + node->full_name, i,PTR_ERR (clk)); +continue ; + }if (__clk_get_flags (clk) &CLK_IS_BASIC ) {pr_warn ("can't setup clkdm for basic clk %s\n" ,__clk_get_name (clk));
Signature · 1 line
2.1.0
Quoted 18 lines · Sebastian Andrzej Siewior
I "forgot" to update the dtb and the kernel crashed:
|Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8because I did not have the clock nodes.
of_clk_get()returns an error pointer which is not checked here.Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- drivers/clk/ti/clockdomain.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/clk/ti/clockdomain.c +0
-0
drivers/clk/ti/clockdomain.c static void __init of_ti_clockdomain_setup(struct device_node *node) · line 41
Quoted 6 lines
drivers/clk/ti/clockdomain.c +3
-0@@ -36,6 +36,11 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)for (i =0 ; i < num_clks; i++) { clk =of_clk_get (node, i); +if (IS_ERR (clk)) { +pr_err ("Failed get %s' clock nr %d (%ld)\n" , + node->full_name, i,PTR_ERR (clk));
Could you add %s: __func__ as well - it kinda helps understand this is part of clockdomain setup and not some driver cribbing that it did not get some clock.
Quoted 6 lines
drivers/clk/ti/clockdomain.c +2
-0+continue ; + }if (__clk_get_flags (clk) &CLK_IS_BASIC ) {pr_warn ("can't setup clkdm for basic clk %s\n" ,__clk_get_name (clk));
PATCH v2 1/1 CLK: TI: consider the fact that of_clk_get() might return an error
I "forgot" to update the dtb and the kernel crashed:
|Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8
because I did not have the clock nodes. of_clk_get() returns an error pointer which is not checked here.
---
v1…v2:
add "%s __func__" to the added pr_err
Quoted 4 lines · * Nishanth Menon | 2014-09-17 07:52:33 [-0500]:
Could you add %s:
__func__as well - it kinda helps understand this is part of clockdomain setup and not some driver cribbing that it did not get some clock.
As you wish.
drivers/clk/ti/clockdomain.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/clk/ti/clockdomain.c +6 -0
@@ -36,6 +36,12 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)for (i =0 ; i < num_clks; i++) { clk =of_clk_get (node, i); +if (IS_ERR (clk)) { +pr_err ("%s: Failed get %s' clock nr %d (%ld)\n" , + __func__, node->full_name, i, +PTR_ERR (clk)); +continue ; + }if (__clk_get_flags (clk) &CLK_IS_BASIC ) {pr_warn ("can't setup clkdm for basic clk %s\n" ,__clk_get_name (clk));
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 29 lines · Sebastian Andrzej Siewior
I "forgot" to update the dtb and the kernel crashed:
|Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8because I did not have the clock nodes.
of_clk_get()returns an error pointer which is not checked here.Signed-off-by Sebastian Andrzej Siewior <[email protected]>---
v1…v2:
add "%s__func__" to the addedpr_errQuoted 4 lines · * Nishanth Menon | 2014-09-17 07:52:33 [-0500]:
Could you add %s:
__func__as well - it kinda helps understand this is part of clockdomain setup and not some driver cribbing that it did not get some clock.As you wish.
drivers/clk/ti/clockdomain.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/clk/ti/clockdomain.c +0
-0
drivers/clk/ti/clockdomain.c static void __init of_ti_clockdomain_setup(struct device_node *node) · line 44
Quoted 9 lines
drivers/clk/ti/clockdomain.c +6
-0@@ -36,6 +36,12 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)for (i =0 ; i < num_clks; i++) { clk =of_clk_get (node, i); +if (IS_ERR (clk)) { +pr_err ("%s: Failed get %s' clock nr %d (%ld)\n" , + __func__, node->full_name, i, +PTR_ERR (clk)); +continue ; + }
Once the following is fixed (checkpatch --strict) feel free to add:
#65: FILE: drivers/clk/ti/clockdomain.c:35:_node *node)
CHECK: Alignment should match open parenthesis
#71: FILE: drivers/clk/ti/clockdomain.c:40:
+ pr_err("%s: Failed get %s' clock nr %d (%ld)\n",
+ __func__, node->full_name, i,
total: 1 errors, 0 warnings, 1 checks, 16 lines checked
If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signature · 6 lines
Regards, Nishanth Menon -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 1/1 CLK: TI: consider the fact that of_clk_get() might return an error
I "forgot" to update the dtb and the kernel crashed:
|Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8
because I did not have the clock nodes. of_clk_get() returns an error pointer which is not checked here.
---
v2?v3:
- added acked by
- fixed "CHECK: Alignment should match open parenthesis"
v1?v2:
add "%s __func__" to the added pr_err
drivers/clk/ti/clockdomain.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/ti/clockdomain.c +5 -0
@@ -36,6 +36,11 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)for (i =0 ; i < num_clks; i++) { clk =of_clk_get (node, i); +if (IS_ERR (clk)) { +pr_err ("%s: Failed get %s' clock nr %d (%ld)\n" , + __func__, node->full_name, i,PTR_ERR (clk)); +continue ; + }if (__clk_get_flags (clk) &CLK_IS_BASIC ) {pr_warn ("can't setup clkdm for basic clk %s\n" ,__clk_get_name (clk));
Signature · 1 line
2.1.0
PATCH v3 1/1 CLK: TI: consider the fact that of_clk_get() might return an error
Quoted 10 lines · Sebastian Andrzej Siewior
I "forgot" to update the dtb and the kernel crashed:
|Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8because I did not have the clock nodes.
of_clk_get()returns an error pointer which is not checked here.Acked-by Nishanth Menon <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Thanks, v3 applied to for-v3.18/ti-clk-drv.
-Tero
Quoted 18 lines
---
v2…v3:
- added acked by
- fixed "CHECK: Alignment should match open parenthesis"v1…v2:
add "%s__func__" to the addedpr_errdrivers/clk/ti/clockdomain.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/clk/ti/clockdomain.c +0
-0@@ -36,6 +36,11 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)
drivers/clk/ti/clockdomain.c static void __init of_ti_clockdomain_setup(struct device_node *node) · line 46
Quoted 10 lines
drivers/clk/ti/clockdomain.c +5
-0for (i =0 ; i < num_clks; i++) { clk =of_clk_get (node, i); +if (IS_ERR (clk)) { +pr_err ("%s: Failed get %s' clock nr %d (%ld)\n" , + __func__, node->full_name, i,PTR_ERR (clk)); +continue ; + }if (__clk_get_flags (clk) &CLK_IS_BASIC ) {pr_warn ("can't setup clkdm for basic clk %s\n" ,__clk_get_name (clk));
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html