Insmod custom driver fails (after probe)

When I execute an insmod of my custom driver, I get the following error.
Strange thing is the the probe has come to the end. So

[   23.657900] tc358746 2-000e: Probe DONE. Detected tc358746 sensor
[   23.663063] Internal error: Attempting to execute userspace memory: 86000005 [#1] PREEMPT SMP
[   23.664841] tc358746 2-000e: tc358746_open:
[   23.675757] Modules linked in: tc358746(+) fuse zram overlay spidev nvgpu bluedroid_pm ip_tables x_tables
[   23.685425] CPU: 0 PID: 6350 Comm: insmod Not tainted 4.9.140-tegra #43
[   23.692032] Hardware name: NVIDIA Jetson Nano Developer Kit (DT)
[   23.698033] task: ffffffc0ca600e00 task.stack: ffffffc0ca7e4000
[   23.703946] PC is at 0xc
[   23.706476] LR is at 0xc
[   23.709007] pc : [<000000000000000c>] lr : [<000000000000000c>] pstate: 40400045
[   23.716391] sp : ffffffc0ca7e7ab0
[   23.719702] x29: ffffffc0ca7e7ab0 x28: 0000000000000018 
[   23.725037] x27: 00000000000000f5 x26: 0000000000000030 
[   23.730368] x25: 0000000000000000 x24: 000000000000000c 
[   23.735699] x23: ffffffc0ca7e7ab0 x22: 0000000000000000 
[   23.741030] x21: 00000000000000f5 x20: 0000000000000030 
[   23.746387] x19: 0000000002000011 x18: 0000000000000010 
[   23.751760] x17: 0000000000000000 x16: 0000000000000000 
[   23.757131] x15: ffffffffffffffff x14: ffffff808a145a82 
[   23.762501] x13: ffffff800a145a90 x12: 0000000000000006 
[   23.767871] x11: 0000000005f5e0ff x10: 0000000000000769 
[   23.773241] x9 : 00000000ffffffd0 x8 : ffffff80083d4750 
[   23.778615] x7 : ffffff8009eb4358 x6 : ffffffc0fefdcbf0 
[   23.783982] x5 : ffffffc0fefdcbf0 x4 : 0000000000000000 
[   23.789352] x3 : ffffffc0fefe27f8 x2 : ffffffc0fefdcbf0 
[   23.794719] x1 : ffffffc0ca600e00 x0 : 0000000000000000 

[   23.801613] Process insmod (pid: 6350, stack limit = 0xffffffc0ca7e4000)
[   23.808335] Call trace:
[   23.810817] [<000000000000000c>] 0xc
[   23.814435] [<ffffff800877e4b0>] driver_probe_device+0x100/0x3b8
[   23.820475] [<ffffff800877e860>] __driver_attach+0xf8/0x100
[   23.826086] [<ffffff800877be14>] bus_for_each_dev+0x5c/0xa8
[   23.831688] [<ffffff800877dcb8>] driver_attach+0x30/0x40
[   23.837030] [<ffffff800877d724>] bus_add_driver+0x20c/0x2a8
[   23.842632] [<ffffff800877f72c>] driver_register+0x6c/0x110
[   23.848264] [<ffffff8008ae1bf4>] i2c_register_driver+0x4c/0xb0
[   23.854253] [<ffffff8000f79018>] tc358746_i2c_driver_init+0x18/0x30 [tc358746]
[   23.861565] [<ffffff8008083afc>] do_one_initcall+0x44/0x130
[   23.867228] [<ffffff80081c2d7c>] do_init_module+0x64/0x1a8
[   23.872803] [<ffffff8008158188>] load_module+0x10a0/0x12d0
[   23.878369] [<ffffff8008158664>] SyS_finit_module+0xd4/0xe8
[   23.884017] [<ffffff80080838c0>] el0_svc_naked+0x34/0x38
[   23.889420] ---[ end trace 85fa808659842c8f ]---
[   24.045953] to_camera_common_data
[   24.101104] to_camera_common_data
[   24.104971] tc358746 2-000e: tc358746_power_off: power off
[   24.110720] tc358746 2-000e: tc358746_power_off: pdata, but NO power_off functionality
[   24.118795] tc358746 2-000e: camera_common_dpd_enable: csi 0
[   24.124578] tc358746 2-000e: camera_common_dpd_enable: csi 1
[   24.130318] tc358746 2-000e: camera_common_dpd_enable: csi 2
[   24.136315] tc358746 2-000e: camera_common_dpd_enable: csi 3
[   24.142021] tc358746 2-000e: camera_common_mclk_disable: disable MCLK
[   24.148634] to_camera_common_data
[   24.151990] tc358746 2-000e: camera_common_mclk_enable
[   24.157144] camera_common_mclk_enable
[   24.160826] tc358746 2-000e: camera_common_mclk_enable: enable MCLK with 24000000 Hz
[   24.168709] tc358746 2-000e: camera_common_dpd_disable: csi 0
[   24.174671] tc358746 2-000e: camera_common_dpd_disable: csi 1
[   24.180668] tc358746 2-000e: camera_common_dpd_disable: csi 2
[   24.186631] tc358746 2-000e: camera_common_dpd_disable: csi 3
[   24.192404] tc358746 2-000e: tc358746_power_on: power on
[   24.197727] tc358746 2-000e: tc358746_power_on: pdata, but NO power_on functionality
[   24.230104] to_camera_common_data
[   24.233496] tc358746 2-000e: tc358746_power_off: power off
[   24.238994] tc358746 2-000e: tc358746_power_off: pdata, but NO power_off functionality
[   24.246966] tc358746 2-000e: camera_common_dpd_enable: csi 0
[   24.252683] tc358746 2-000e: camera_common_dpd_enable: csi 1
[   24.258452] tc358746 2-000e: camera_common_dpd_enable: csi 2
[   24.264152] tc358746 2-000e: camera_common_dpd_enable: csi 3
[   24.269838] tc358746 2-000e: camera_common_mclk_disable: disable MCLK

investigating with gdb don’t shed any light on the problem

(gdb) l *driver_probe_device+0x100
0xbd8 is at /home/builder/Linux/kernelfiles/kernel/kernel-4.9/drivers/base/dd.c:367.
362			if (ret)
363				goto probe_failed;
364		}
365	
366		if (dev->bus->probe) {
367			ret = dev->bus->probe(dev);
368			if (ret)
369				goto probe_failed;
370		} else if (drv->probe) {
371			ret = drv->probe(dev);

Any pointers?

hello Sbuteo,

it usually caused by sensor capability parse failed. you may check Sensor Software Driver Programming Guide for those property-value pairs.

also,
there’re several IOCTL operations included during sensor init stage.
you may check below to report sensor capability, or return valid values to complete sensor probing process.
for example,

static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
	.vidioc_querycap		= tegra_channel_querycap,
	.vidioc_enum_framesizes		= tegra_channel_enum_framesizes,
	.vidioc_enum_frameintervals	= tegra_channel_enum_frameintervals,
	.vidioc_enum_fmt_vid_cap	= tegra_channel_enum_format,
	.vidioc_g_fmt_vid_cap		= tegra_channel_get_format,
	.vidioc_s_fmt_vid_cap		= tegra_channel_set_format,
	.vidioc_try_fmt_vid_cap		= tegra_channel_try_format,
	.vidioc_reqbufs			= vb2_ioctl_reqbufs,
	.vidioc_prepare_buf		= vb2_ioctl_prepare_buf,
	.vidioc_querybuf		= vb2_ioctl_querybuf,
	.vidioc_qbuf			= vb2_ioctl_qbuf,
	.vidioc_dqbuf			= vb2_ioctl_dqbuf,
	.vidioc_create_bufs		= vb2_ioctl_create_bufs,
	.vidioc_expbuf			= vb2_ioctl_expbuf,
	.vidioc_streamon		= vb2_ioctl_streamon,
	.vidioc_streamoff		= vb2_ioctl_streamoff,
	.vidioc_g_edid			= tegra_channel_g_edid,
	.vidioc_s_edid			= tegra_channel_s_edid,
	.vidioc_s_dv_timings		= tegra_channel_s_dv_timings,
	.vidioc_g_dv_timings		= tegra_channel_g_dv_timings,
	.vidioc_query_dv_timings	= tegra_channel_query_dv_timings,
	.vidioc_enum_dv_timings		= tegra_channel_enum_dv_timings,
	.vidioc_dv_timings_cap		= tegra_channel_dv_timings_cap,
	.vidioc_subscribe_event		= tegra_channel_subscribe_event,
	.vidioc_unsubscribe_event	= v4l2_event_unsubscribe,
	.vidioc_enum_input		= tegra_channel_enum_input,
	.vidioc_g_input			= tegra_channel_g_input,
	.vidioc_s_input			= tegra_channel_s_input,
	.vidioc_log_status		= tegra_channel_log_status,
	.vidioc_default			= tegra_channel_default_ioctl,
};