Re: [PATCH] staging: mt7621-pinctrl: fix pinmux warning at boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sergio,

On 14/1/19 4:45 pm, Sergio Paracuellos wrote:
On Mon, Jan 14, 2019 at 6:36 AM Greg Ungerer <gerg@xxxxxxxxxx> wrote:

Fix unassigned "num_maps" when calling pinctrl_utils_reserve_map() in
the satging mt7621-pinctrl driver. Although we do set an initial "map"
pointer to NULL, there is no initialization of the "num_maps" argument.

Uninitialized "num_maps" causes the following warning on boot on 5.0-rc1:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at mm/page_alloc.c:4511 __alloc_pages_nodemask+0x1d0/0xb70
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc1-00004-gf3cdc52549a2 #2
Stack : 00000046 00000000 00000000 807e0000 87d1e580 8006fb04 8072da9c 0000000b
         00000000 00000000 8072d2dc 87c3d894 80770000 00000001 87c3d828 588f41e8
         00000000 00000000 80820000 00000000 00000000 807e76a6 00000047 00000000
         2d316372 00000000 00000000 00000000 80770000 00000000 806eb6b8 00000009
         0000119f 80770000 80700000 807016cc 00000010 00000001 00000000 807e0000
         ...
Call Trace:
[<8000cfe0>] show_stack+0x94/0x12c
[<8060dd7c>] dump_stack+0x8c/0xd0
[<80028430>] __warn+0x10c/0x120
[<80028554>] warn_slowpath_null+0x44/0x60
[<800e27a8>] __alloc_pages_nodemask+0x1d0/0xb70
[<800fe4a8>] kmalloc_order+0x20/0x54
[<800fe858>] krealloc+0x7c/0x108
[<802ec9c8>] pinctrl_utils_reserve_map+0x88/0x100
[<80445f0c>] rt2880_pinctrl_dt_node_to_map+0xa0/0x18c
[<802ede20>] pinctrl_dt_to_map+0x274/0x394
[<802eb7cc>] create_pinctrl+0x80/0x478
[<802ebd7c>] pinctrl_enable+0x20/0x148
[<802ebed0>] pinctrl_register+0x2c/0x50
[<80446514>] rt2880_pinmux_probe+0x51c/0x758
[<80352d24>] platform_drv_probe+0x40/0x9c
[<80350e48>] really_probe+0x1f0/0x35c
[<8034ed74>] bus_for_each_drv+0x78/0xd0
[<80350c10>] __device_attach+0xdc/0x11c
[<8034ff04>] bus_probe_device+0xa0/0xbc
[<8034c548>] device_add+0x3c8/0x618
[<8043df90>] of_platform_device_create_pdata+0xac/0x120
[<8043e1b4>] of_platform_bus_create+0x168/0x260
[<8043e42c>] of_platform_populate+0x7c/0xec
[<8079985c>] __dt_register_buses+0x70/0x90
[<80798df0>] plat_of_setup+0x1c/0x34
[<800015f4>] do_one_initcall+0x50/0x1ac
[<80795e48>] kernel_init_freeable+0x184/0x26c
[<8062bad4>] kernel_init+0x14/0x110
[<80007198>] ret_from_kernel_thread+0x14/0x1c
---[ end trace d752c6e38e5b8de8 ]---
rt2880-pinmux pinctrl: krealloc(map) failed
rt2880-pinmux pinctrl: can't reserve map: -12
rt2880-pinmux pinctrl: error claiming hogs: -12
rt2880-pinmux pinctrl: could not claim hogs: -12
rt2880-pinmux: probe of pinctrl failed with error -12

Signed-off-by: Greg Ungerer <gerg@xxxxxxxxxx>
---
  drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index aa98fbb17013..b007f905b24e 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -89,6 +89,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev,
                 ngroups++;

         *map = NULL;
+       *num_maps = 0;
         ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps,
                                         num_maps, ngroups);
         if (ret) {
--
2.17.1


This warning has been fixed and patches applied to the staging tree
last week. Please see:

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing&id=0ca1f90861b6d64386261096b42bfc81ce11948a
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing&id=bd7c95d48854af2db899bc8b6966a0e9b9f5bf4e

Ok, great, thanks.

Regards
Greg



_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux