We are encountering a kernel panic issue on the i.MX93 platform when booting the system. The error message indicates "Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000". This occurs during the initialization of the ap1302 driver.
[ 7.967148] debugfs: Directory '2-003d' with parent 'regmap' already present!
[ OK ] Started 7.976999] ap1302_mipi 2-003d: Requesting firmware /imx/camera/ap1302_ar1335_single_fw.bin
1;39mGetty on tty1.
[ 7.995154] ap1302_mipi 2-003d: Firmware header version : 1
[ 8.001580] ap1302_mipi 2-003d: Firmware description : Release 433 @ 1-12-2023 0:15:4 - AP1302-REV2-AR1335-REV2-IAS1MOD-AR1335CSSC080110 - No Clock - NO SIP
[ 8.033268] ap1302_mipi 2-003d: AP1302 revision 0.2.6 detected
[ 8.044193] rtc-pcf2131-i2c: probe of 2-0053 failed with error -5
[ OK ] Started Serial Gett[ 8.054218] ap1302_mipi 2-003d: AP1302 oscillator clock 40000000 hz (FP 0x00280000)
y on ttyLP0.
[ OK ] Reached target Login Prompts.
[ 8.083942] wm8962 0-001a: Failed to read ID register
Starting Weston, a Wayland…ositor, as a system service...
Starting WPA supplicant...
[ 8.162260] fsl_mc_err_probe: No ECC DIMMs discovered
[ 8.174338] ap1302_mipi 2-003d: AP1302 MIPI frequency 900000000 hz (FP 0x03840000)
[ 8.188137] ap1302_mipi 2-003d: ap1302_write_fw_window len 83104d
[ 8.191735] wm8962: probe of 0-001a failed with error -5
[ 8.229543] audit: type=1334 audit(1717405758.586:6): prog-id=9 op=LOAD
[ 8.250948] audit: type=1334 audit(1717405758.598:7): prog-id=10 op=LOAD
Starting Hostname Service...
[ 8.315157] audit: type=1334 audit(1717405758.670:8): prog-id=11 op=LOAD
[ 8.331462] audit: type=1334 audit(1717405758.690:9): prog-id=12 op=LOAD
Starting User Database Manager...
[ OK ] Started WPA supplicant.
[ OK ] Reached target Hardware activated USB gadget.
[ OK ] Started User Database Manager.
[ OK ] Started Hostname Service.
[ OK ] Created slice User Slice of UID 0.
Starting User Runtime Directory /run/user/0...
[ OK ] Created slice Slice /system/systemd-fsck.
[ OK ] Found device /dev/mmcblk1p1.
Starting File System Check on /dev/mmcblk1p1...
[ OK ] Finished User Runtime Directory /run/user/0.
Starting User Manager for UID 0...
[ 9.186313] audit: type=1006 audit(1717405759.542:10): pid=487 uid=0 old-auid=4294967295 auid=0 tty=(none) old-ses=4294967295 ses=1 res=1
[ 9.207393] audit: type=1300 audit(1717405759.542:10): arch=c00000b7 syscall=64 success=yes exit=1 a0=8 a1=ffffd27fe6b0 a2=1 a3=1 items=0 ppid=1 pid=487 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm="(systemd)" exe="/lib/systemd/systemd" key=(null)
[ 9.251400] audit: type=1327 audit(1717405759.542:10): proctitle="(systemd)"
[ 9.381280] audit: type=1334 audit(1717405759.738:11): prog-id=13 op=LOAD
[ OK ] Finished File System Check on /dev/mmcblk1p1.
Mounting /run/media/BOOT-mmcblk1p1...
[ 9.862166] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[ OK ] Mounted /run/media/B[ 9.875193] Mem abort info:
OOT-mmcblk1p1.
[ OK ] Started User Manager for UID 0.
[ 9.932277] ESR = 0x0000000096000044
[ 9.976305] EC = 0x25: DABT (current EL), IL = 32 bits
[ OK ] Started Session c1 [ 9.993424] SET = 0, FnV = 0
of User root[ 9.997406] EA = 0, S1PTW = 0
.
[ 10.003584] FSC = 0x04: level 0 translation fault
[ 10.017283] Data abort info:
[ 10.024599] ISV = 0, ISS = 0x00000044
[ 10.030656] CM = 0, WnR = 1
[ 10.035035] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000085cef000
[ 10.042256] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[ 10.049667] Internal error: Oops: 0000000096000044 [#1] PREEMPT SMP
[ 10.055934] Modules linked in: crct10dif_ce polyval_ce polyval_generic snd_soc_fsl_asoc_card snd_soc_imx_audmux snd_soc_imx_card layerscape_edac_mod snd_soc_wm8962 snd_soc_fsl_micfil ap1302(O+) rtc_pcf2131 flexcan snd_soc_fsl_sai snd_soc_fsl_utils snd_soc_fsl_xcvr can_dev imx8_media_dev(C) fuse
[ 10.081996] CPU: 0 PID: 217 Comm: (udev-worker) Tainted: G C O 6.1.55+g770c5fe2c1d1 #1
[ 10.091109] Hardware name: NXP i.MX93 11X11 EVK board (DT)
[ 10.096580] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 10.103529] pc : __memcpy+0x128/0x240
[ 10.107186] lr : i2c_put_dma_safe_msg_buf+0x58/0x60
[ 10.112057] sp : ffff80000abab5c0
[ 10.115358] x29: ffff80000abab5c0 x28: ffff000004555880 x27: ffff000004555e80
[ 10.122482] x26: 0000000000000000 x25: ffff000004555cd0 x24: 0000000000000002
[ 10.129607] x23: 00000000000000fa x22: 00000000fffee479 x21: 0000000000000000
[ 10.136730] x20: ffff80000abab758 x19: ffff000008556000 x18: 0000000000000000
[ 10.143854] x17: ffff80007602c000 x16: ffff800008000000 x15: 0000000000000000
[ 10.150978] x14: 0000000000000000 x13: 44c10e1a3748c516 x12: 020b024417b49031
[ 10.158102] x11: 0000000000000001 x10: 0000000000000a60 x9 : ffff80000abab470
[ 10.165226] x8 : ffff00007fb99000 x7 : 044c2caab91e0225 x6 : 7458460120ad233d
[ 10.172350] x5 : 0000000000002000 x4 : ffff000008558000 x3 : 0000000000000000
[ 10.179474] x2 : 0000000000002000 x1 : ffff000008556000 x0 : 0000000000000000
[ 10.186602] Call trace:
[ 10.189038] __memcpy+0x128/0x240
[ 10.192347] lpi2c_imx_xfer+0x6b8/0x9f4
[ 10.196178] __i2c_transfer+0x150/0x490
[ 10.200009] i2c_transfer+0x60/0x100
[ 10.203579] regmap_i2c_read+0x6c/0xb4
[ 10.207320] _regmap_raw_read+0xdc/0x160
[ 10.211240] regmap_raw_read+0x190/0x270
[ 10.215158] ap1302_probe+0xb78/0x1400 [ap1302]
[ 10.219688] i2c_device_probe+0x380/0x3d0
[ 10.223694] really_probe+0xbc/0x2dc
[ 10.227265] __driver_probe_device+0x78/0x114
[ 10.231616] driver_probe_device+0x3c/0x15c
[ 10.235793] __driver_attach+0x94/0x19c
[ 10.239624] bus_for_each_dev+0x78/0xd4
[ 10.243452] driver_attach+0x24/0x30
[ 10.247025] bus_add_driver+0x154/0x20c
[ 10.250853] driver_register+0x78/0x130
[ 10.254684] i2c_register_driver+0x48/0xd0
[ 10.258774] ap1302_i2c_driver_init+0x20/0x1000 [ap1302]
[ 10.264078] do_one_initcall+0x68/0x1ec
[ 10.267909] do_init_module+0x48/0x1d0
[ 10.271653] load_module+0x1774/0x1cd0
[ 10.275391] __do_sys_finit_module+0xac/0x104
[ 10.279742] __arm64_sys_finit_module+0x20/0x30
[ 10.284266] invoke_syscall+0x48/0x114
[ 10.288009] el0_svc_common.constprop.0+0xcc/0xec
[ 10.292707] do_el0_svc+0x2c/0xd0
[ 10.296015] el0_svc+0x2c/0x84
[ 10.299069] el0t_64_sync_handler+0xf4/0x120
[ 10.303330] el0t_64_sync+0x18c/0x190
[ 10.306985] Code: 927cec03 cb0e0021 8b0e0042 a9411c26 (a900340c)
[ 10.313067] ---[ end trace 0000000000000000 ]---
This issue seems to originate from the ap1302_probe function, which is called during the initialization of the ap1302 driver. The problem may be due to a NULL pointer being dereferenced within the kernel space.
We have checked the code, but couldn't identify the exact cause. Could you please assist us in debugging this issue?