Maybe you need to change:
int err, i = MAX_LANE_NUM, attempt_counter = 0;
u32 status;
err_retry_init:
to
int err, i, attempt_counter = 0;
u32 status;
err_retry_init:
i = MAX_LANE_NUM;
?
Or just change the "while"s into for loops.
My rootfs is on the sdcard, I've taken the card out, booted an old laptop on https://www.system-rescue.org/ and using an SD card reader copied /boot and /lib/modules from a known-working Armbian image to the card. Boot, then apt update/apt upgrade to get the fixed kernel. I've also started backing up the current kernel every time I run an upgrade 🙂