{"action":"created","issue":{"url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/36","repository_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux","labels_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/36/comments","events_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/36/events","html_url":"https://github.com/daniel-santos/mcp2210-linux/issues/36","id":378468155,"node_id":"MDU6SXNzdWUzNzg0NjgxNTU=","number":36,"title":"Kernel Oops - BUG() getting called","user":{"login":"satva","id":11969761,"node_id":"MDQ6VXNlcjExOTY5NzYx","avatar_url":"https://avatars3.githubusercontent.com/u/11969761?v=4","gravatar_id":"","url":"https://api.github.com/users/satva","html_url":"https://github.com/satva","followers_url":"https://api.github.com/users/satva/followers","following_url":"https://api.github.com/users/satva/following{/other_user}","gists_url":"https://api.github.com/users/satva/gists{/gist_id}","starred_url":"https://api.github.com/users/satva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satva/subscriptions","organizations_url":"https://api.github.com/users/satva/orgs","repos_url":"https://api.github.com/users/satva/repos","events_url":"https://api.github.com/users/satva/events{/privacy}","received_events_url":"https://api.github.com/users/satva/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-07T21:03:46Z","updated_at":"2018-11-08T01:08:11Z","closed_at":null,"author_association":"NONE","body":"Hi , \r\n\r\nmcp2210 was trying to do simple register read (triggered by spi_nor_read_id)  and resulted in kcrash as shown below.  MCP2210 was trying to process command - 0x42 (SPI_DATA_TRANSFER) and hit this issue at repeat-count # 3.  Going by the trace, assert(0) was triggered as variable \"body_size\" was > 0 but \"body\" was NULL. (can see in the extra prints below). Any pointers please as bit new to SPI itself of which scenario lands at this case ! \r\n\r\n(Kernel version -  4.1.35-rt41) \r\n\r\n```\r\nusb 1-1.1: process_commands: running command bd2a3380 again (repeat_count = 3)\r\n***process_commands,1587***\r\n***process_commands,1635***\r\n***1***\r\nusb 1-1.1: submit_urbs:\r\n***submit_urbs,2359***\r\n******spi_submit_prepare,657******\r\n******mcp2210_init_msg,1094,6,4,CMD:42******\r\n******mcp2210_init_msg,1104,6,4******\r\n------------[ cut here ]------------\r\nkernel BUG at buildroot/mcp2210_driver/mcp2210.h:1105!\r\nInternal error: Oops - BUG: 0 [#1] SMP THUMB2\r\nModules linked in: mcp2210\r\nCPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 4.1.35-rt41 #198\r\nHardware name: Freescale LS1021A\r\nWorkqueue: events mcp2210_spi_probe_async [mcp2210]\r\ntask: bf1a9300 ti: bf20a000 task.ti: bf20a000\r\nPC is at spi_submit_prepare+0x229/0x2d4 [mcp2210]\r\nLR is at spi_submit_prepare+0x22a/0x2d4 [mcp2210]\r\npc : [<7f802fde>]    lr : [<7f802fdf>]    psr: 600e01b3\r\nsp : bf20b958  ip : 0000001c  fp : bd1a6000\r\nr10: bd2a3380  r9 : 00000004  r8 : bccef040\r\nr7 : 00000000  r6 : 00000006  r5 : bd1a6000  r4 : bd2a3380\r\nr3 : 00000001  r2 : 80c06404  r1 : 800e0193  r0 : 00000025\r\nFlags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA Thumb  Segment kernel\r\nControl: 70c5387d  Table: bd22f400  DAC: fffffffd\r\nProcess kworker/0:1 (pid: 18, stack limit = 0xbf20a210)\r\nStack: (0xbf20b958 to 0xbf20c000)\r\nb940:                                                       00000004 00000042\r\nb960: 00000001 bd2a3380 bd1a6000 8004a847 7f807740 bf20b994 3ebe3000 802b8ee3\r\nb980: 7f807740 bd1a6000 00000000 7f8094c8 00000001 00000000 00000001 7f80082f\r\nb9a0: bd2a3380 00000003 7f80864f 7f8060e3 00000001 bccef040 00000002 bd1a6000\r\nb9c0: 00000000 bd2a3380 00000001 00000000 600e0193 7f806188 00000002 7f800e6d\r\nb9e0: bd2a3400 01020000 00204000 7f800b79 bd2a3400 000e0193 00000000 00000000\r\nba00: 00000001 bd2a3400 bd21a000 801e9b75 bf02c000 bd2e4bc0 bd7fea30 8020018b\r\nba20: bd21a0f4 bf20ba54 00000000 8017b387 bd21a0f4 bccda000 00000001 00000000\r\nba40: 00000003 8001c275 bf811840 bd7ec130 00000001 00000000 00000000 bf7d9880\r\nba60: bf1a9348 bf02c000 bd7fea30 bf20bc28 00000031 00000000 00000000 00000000\r\nba80: bf20a000 802005b5 80bfa140 bf02c02c bd7fe9e0 80bf6e40 bf7d6570 bd006640\r\nbaa0: 00000031 bf20bc28 00000031 00000000 00000000 00000000 bf20a000 801e9523\r\nbac0: 801e9505 8004b501 80bf6e00 800563d3 bf1309c0 80025140 00000006 bf1309c0\r\nbae0: bf130a28 bf20bc28 00000031 bf00c800 00000001 00000000 bf10d549 8004b651\r\nbb00: bf1309c0 80c16140 bf20bc28 8004d73d 8004d6d5 00000031 80bf4cb8 8004af25\r\nbb20: 00000000 8004b119 bf20bb58 c0802000 80bfc0e0 bf20bb58 bf20bb8c 80c43ac0\r\nbb40: 80bfa080 8000927f 80025140 400e0133 ffffffff 802bce9b 00000001 00000008\r\nbb60: 00000000 00000000 bf20a000 80bfa140 00000002 00000011 80c43ac0 80bfa080\r\nbb80: 00000000 bf10d549 00000000 bf20bba0 800250fb 80025140 400e0133 ffffffff\r\nbba0: 00000006 bf7dc440 04208060 bf20bba0 0000000a 00000011 ffff95f4 00000000\r\nbbc0: 80bfa140 80226d85 80226d61 00000000 80bf4cb8 00000000 00000011 bf00c800\r\nbbe0: 00000001 00000000 bf10d549 8002578b 00000000 8004b11d bf20bc28 c0802000\r\nbc00: 80bfc0e0 bf20bc28 bf20bc5c bd2e0200 00000000 8000927f 802bc916 000e0033\r\nbc20: ffffffff 802bce9b bcd0b99c 600e0013 80c06404 00000001 00000000 bcd0b99c\r\nbc40: 600e0013 bf20bcc0 bd2e0200 00000000 00000000 bf10d549 00000018 bf20bc70\r\nbc60: 801c0673 802bc916 000e0033 ffffffff 00000001 bd2e0200 bf20bcc0 bcd0b800\r\nbc80: 801c0749 801c1639 00000000 00000000 bf20bc90 bf20bc90 3ebe3000 bf11a541\r\nbca0: bf11a540 00000006 bf20bdba bd2e0200 bf20bd97 00000000 bf10d549 801c1775\r\nbcc0: bf20bd24 bf20bd60 bd2e0200 00000000 801c05b1 bf20bc88 0000000e 00000001\r\nbce0: ffffff8d 00000000 00000000 00000000 bf11a540 00000000 00000001 00000000\r\nbd00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000802\r\nbd20: 00b71b00 bf20bd60 bf20bcc0 00000000 bf11a541 00000006 00000000 00000000\r\nbd40: 00000000 00000000 00000000 00000000 00000000 00000000 00000810 00b71b00\r\nbd60: bf20bcc0 bf20bd24 803db877 bf20bd97 bd2e0200 bf20bdba 00000006 00000000\r\nbd80: 803db8a9 801b9683 00000006 802b8ee3 803db877 9f20bda4 00000387 801b9651\r\nbda0: 802ede44 bcd0b418 bd2e0390 801beee3 bcd0b418 800d0013 80c06404 00000001\r\nbdc0: bcd0b418 802ede44 bd2e0200 801bf8e5 00000300 801847f7 bd2e033c 80184803\r\nbde0: 801845cb 00000000 bd2e0200 bd2e0390 00000000 bcd0b418 00000000 80c69028\r\nbe00: bf10d549 801b9905 bd2e0200 00000001 80c251f0 bd2e0200 80c6904c 80c25200\r\nbe20: 0000000c 801c04f5 801c04bd bd2e0200 00000000 80182b25 00000000 bd2e0200\r\nbe40: 80182c0d bcd0b800 00000000 80181b7f bf10eb70 bd7da5b8 bd2e0200 80c28d5c\r\nbe60: bd2e0234 80182a55 bd2e0200 80c28d5c bd2e0200 80182445 bd2e0200 00000000\r\nbe80: bd2e0208 8018135d bd2e0200 800f0013 00000029 0000002a bd2e0200 00000000\r\nbea0: bcd0b800 bcd0a068 bd1a6390 bd2e4840 bcd0b800 801c0aff 00000001 bd2e0200\r\nbec0: bd1a6000 00000000 7f8094c8 7f80327d 80c55c80 80055bc5 bd7f5e10 bd1a6390\r\nbee0: bd2e0390 bf10d400 00000004 bf1f5c80 bd2e4840 bf7d93c0 00000000 bf7dc800\r\nbf00: bf7d93d4 00000000 00000008 80031089 bf1f5c80 bd2e4840 bf7dcc58 bf1f5c80\r\nbf20: bf7d93c0 bf7d93c0 80bfa140 bf1f5c98 bf7d93d4 00000000 00000008 800315d5\r\nbf40: bf1a9300 bf1ff240 00000000 bf1f5c80 800313e9 00000000 00000000 00000000\r\nbf60: 00000000 800340c1 00000000 00000000 00000000 bf1f5c80 00000000 00000000\r\nbf80: bf20bf80 bf20bf80 00000000 00000000 bf20bf90 bf20bf90 00000000 bf1ff240\r\nbfa0: 80034031 00000000 00000000 80012b61 00000000 00000000 00000000 00000000\r\nbfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000\r\nbfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000\r\n[<7f802fde>] (spi_submit_prepare [mcp2210]) from [<7f80082f>] (process_commands+0x412/0x5a8 [mcp2210])\r\n[<7f80082f>] (process_commands [mcp2210]) from [<7f800e6d>] (complete_urb+0x2f4/0x334 [mcp2210])\r\n[<7f800e6d>] (complete_urb [mcp2210]) from [<801e9b75>] (__usb_hcd_giveback_urb+0x45/0x90)\r\n[<801e9b75>] (__usb_hcd_giveback_urb) from [<8020018b>] (handle_tx_event+0x80f/0x844)\r\n[<8020018b>] (handle_tx_event) from [<802005b5>] (xhci_irq+0x3f5/0x4f0)\r\n[<802005b5>] (xhci_irq) from [<801e9523>] (usb_hcd_irq+0x1f/0x2a)\r\n[<801e9523>] (usb_hcd_irq) from [<8004b501>] (handle_irq_event_percpu+0x6d/0x184)\r\n[<8004b501>] (handle_irq_event_percpu) from [<8004b651>] (handle_irq_event+0x39/0x4c)\r\n[<8004b651>] (handle_irq_event) from [<8004d73d>] (handle_fasteoi_irq+0x69/0xbc)\r\n[<8004d73d>] (handle_fasteoi_irq) from [<8004af25>] (generic_handle_irq+0x19/0x22)\r\n[<8004af25>] (generic_handle_irq) from [<8004b119>] (__handle_domain_irq+0x59/0x7c)\r\n[<8004b119>] (__handle_domain_irq) from [<8000927f>] (gic_handle_irq+0x2f/0x48)\r\n[<8000927f>] (gic_handle_irq) from [<802bce9b>] (__irq_svc+0x3b/0x5c)\r\nException stack(0xbf20bb58 to 0xbf20bba0)\r\nbb40:                                                       00000001 00000008\r\nbb60: 00000000 00000000 bf20a000 80bfa140 00000002 00000011 80c43ac0 80bfa080\r\nbb80: 00000000 bf10d549 00000000 bf20bba0 800250fb 80025140 400e0133 ffffffff\r\n[<802bce9b>] (__irq_svc) from [<80025140>] (__do_softirq+0x5c/0x218)\r\n[<80025140>] (__do_softirq) from [<8002578b>] (irq_exit+0x53/0xa4)\r\n[<8002578b>] (irq_exit) from [<8004b11d>] (__handle_domain_irq+0x5d/0x7c)\r\n[<8004b11d>] (__handle_domain_irq) from [<8000927f>] (gic_handle_irq+0x2f/0x48)\r\n[<8000927f>] (gic_handle_irq) from [<802bce9b>] (__irq_svc+0x3b/0x5c)\r\nException stack(0xbf20bc28 to 0xbf20bc70)\r\nbc20:                   bcd0b99c 600e0013 80c06404 00000001 00000000 bcd0b99c\r\nbc40: 600e0013 bf20bcc0 bd2e0200 00000000 00000000 bf10d549 00000018 bf20bc70\r\nbc60: 801c0673 802bc916 000e0033 ffffffff\r\n[<802bce9b>] (__irq_svc) from [<802bc916>] (_raw_spin_unlock_irqrestore+0x1c/0x1e)\r\n[<802bc916>] (_raw_spin_unlock_irqrestore) from [<801c0673>] (spi_async_locked+0x41/0x4e)\r\n[<801c0673>] (spi_async_locked) from [<801c1639>] (__spi_sync+0xef/0x17e)\r\n[<801c1639>] (__spi_sync) from [<801c1775>] (spi_write_then_read+0xa3/0xfe)\r\n[<801c1775>] (spi_write_then_read) from [<801b9683>] (m25p80_read_reg+0x33/0x64)\r\n[<801b9683>] (m25p80_read_reg) from [<801beee3>] (spi_nor_read_id+0x27/0xc0)\r\n[<801beee3>] (spi_nor_read_id) from [<801bf8e5>] (spi_nor_scan+0xc9/0x4c4)\r\n[<801bf8e5>] (spi_nor_scan) from [<801b9905>] (m25p_probe+0x8d/0xc8)\r\n[<801b9905>] (m25p_probe) from [<801c04f5>] (spi_drv_probe+0x39/0x48)\r\n[<801c04f5>] (spi_drv_probe) from [<80182b25>] (driver_probe_device+0x9d/0x184)\r\n[<80182b25>] (driver_probe_device) from [<80181b7f>] (bus_for_each_drv+0x47/0x52)\r\n[<80181b7f>] (bus_for_each_drv) from [<80182a55>] (device_attach+0x41/0x58)\r\n[<80182a55>] (device_attach) from [<80182445>] (bus_probe_device+0x1d/0x64)\r\n[<80182445>] (bus_probe_device) from [<8018135d>] (device_add+0x2b9/0x354)\r\n[<8018135d>] (device_add) from [<801c0aff>] (spi_add_device+0x8f/0xcc)\r\n[<801c0aff>] (spi_add_device) from [<7f80327d>] (mcp2210_spi_probe_async+0xf4/0x190 [mcp2210])\r\n[<7f80327d>] (mcp2210_spi_probe_async [mcp2210]) from [<80031089>] (process_one_work+0x17d/0x2c4)\r\n[<80031089>] (process_one_work) from [<800315d5>] (worker_thread+0x1ed/0x2dc)\r\n[<800315d5>] (worker_thread) from [<800340c1>] (kthread+0x91/0xa0)\r\n[<800340c1>] (kthread) from [<80012b61>] (ret_from_fork+0x11/0x30)\r\nCode: 4929 482a f2b5 df73 (de02) f1d6\r\n---[ end trace ad87c7587c4410f5 ]---\r\nKernel panic - not syncing: Fatal exception in interrupt\r\n---[ end Kernel panic - not syncing: Fatal exception in interrupt\r\n```\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/comments/436836231","html_url":"https://github.com/daniel-santos/mcp2210-linux/issues/36#issuecomment-436836231","issue_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/36","id":436836231,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjgzNjIzMQ==","user":{"login":"daniel-santos","id":980562,"node_id":"MDQ6VXNlcjk4MDU2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/980562?v=4","gravatar_id":"","url":"https://api.github.com/users/daniel-santos","html_url":"https://github.com/daniel-santos","followers_url":"https://api.github.com/users/daniel-santos/followers","following_url":"https://api.github.com/users/daniel-santos/following{/other_user}","gists_url":"https://api.github.com/users/daniel-santos/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-santos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-santos/subscriptions","organizations_url":"https://api.github.com/users/daniel-santos/orgs","repos_url":"https://api.github.com/users/daniel-santos/repos","events_url":"https://api.github.com/users/daniel-santos/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-santos/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T01:08:11Z","updated_at":"2018-11-08T01:08:11Z","author_association":"OWNER","body":"OK, so I have a sinking suspicion that you've forgotten to initialize the tx_buf of your struct spi_transfer.  I just pushed a commit that better validates this -- I had validation prior, but it was only enabled if `CONFIG_MCP2210_DEBUG` was enabled and it was wrong anyway, because it only failed when both tx and rx buffers were NULL.\r\n\r\nDo a pull and give it a try.  You should get a `BUG_ON(!xfer->tx_buf)` in `queue_msg` this time.  Please let me know."}}
{"actor":{"display_login":"daniel-santos"}}