通过串口log信息解决无限重启问题——空指针异常

获取串口log过程

SecureCRT 配制

波特率:92160
RTS/CTS

串口线
1. 黑线:GND
2. 蓝线:RX (板子recive)
3. 白线:TX(板子send)

串口log信息

[1380] DISP/ DSI read long packet size: 3
lcm_compare_id,lk ST7701S id = 0x88,id1 = 0x 2

[    1.534724]<3>.(2)[1:swapper/0][DDP/IRQ]register callback on 0
[    1.535214]<3>.(2)[1:swapper/0][DEVINFO LCM]Num:[0] type:[LCM] module:[JD-45FS0005-V0] vendor:[JUNDA] ic:[ILI9806E] info:[480*854] used:[false]
[    1.535231]<3>.(2)[1:swapper/0][DEVINFO LCM]Num:[1] type:[LCM] module:[TXDY450SFWPC-15] vendor:[TONGXINGDA] ic:[FL10802] info:[480*854] used:[false]
[    1.535245]<3>.(2)[1:swapper/0][DEVINFO LCM]Num:[2] type:[LCM] module:[(null)] vendor:[(null)] ic:[(null)] info:[(null)] used:[true]
[    1.535253]<3>.(2)[1:swapper/0][DISP]func|disp_lcm_probe
[    1.535261]<3>.(2)[1:swapper/0][DISPCHECK]plcm_name=st7701_fwvga_dsi_vdo_gt
[    1.535312]<3>.(2)[1:swapper/0][DISP][disp_lcm_probe #230]ERROR:FATAL ERROR: can't found lcm driver:st7701_fwvga_dsi_vdo_gt in linux kernel driver
[    1.535326]<3>.(2)[1:swapper/0][DISPCHECK][LCM], name: st7701_fwvga_dsi_vdo_gt
[    1.535334]<3>.(2)[1:swapper/0][DISPCHECK][LCM] resolution: 480 x 854
[    1.535342]<3>.(2)[1:swapper/0][DISPCHECK][LCM] physical size: 0 x 0
[    1.535350]<3>.(2)[1:swapper/0][DISPCHECK][LCM] physical size: 0 x 0


[    1.904048]<2>.(0)[100:frame_update_wo][DEVINFO LCM]registe LCM device!num:<0> type:<LCM> module:<JD-45FS0005-V0> vendor<JUNDA> ic<ILI9806E> version<(null)> info<480*854> used<false>
[    1.904057]<2>.(0)[100:frame_update_wo][DEVINFO] devinfo_check!
[    1.904122]<2>.(0)[100:frame_update_wo][DEVINFO LCM]registe LCM device!num:<1> type:<LCM> module:<TXDY450SFWPC-15> vendor<TONGXINGDA> ic<FL10802> version<(null)> info<480*854> used<false>
[    1.904129]<2>.(0)[100:frame_update_wo][DEVINFO] devinfo_check!
[    1.904137]<2>-(0)[100:frame_update_wo][DEVINFO] dev type:LCM
[    1.904143]<2>-(0)[100:frame_update_wo][DEVINFO] dev list type:LCM
[    1.904157]<2>.(0)[100:frame_update_wo][DEVINFO LCM]registe LCM device!num:<2> type:<LCM> module:<(null)> vendor<(null)> ic<(null)> version<(null)> info<(null)> used<true>
[    1.904163]<2>.(0)[100:frame_update_wo][DEVINFO] devinfo_check!
[    1.904171]<2>-(0)[100:frame_update_wo][DEVINFO] dev type:LCM
[    1.904177]<2>-(0)[100:frame_update_wo][DEVINFO] dev list type:LCM
[    1.904192]<2>-(0)[100:frame_update_wo]Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    1.904199]<2>-(0)[100:frame_update_wo]pgd = c0004000
[    1.904211]<2>-(0)[100:frame_update_wo][00000000] *pgd=00000000
[    1.904223]<2>-(0)[100:frame_update_wo][KERN Warning] ERROR/WARN forces debug_lock off!

M]Num:[2] type:[LCM] module:[(null)] vendor:[(null)] ic:[(null)] info:[(null)] used:[true]

registe LCM device!num:<2> type:<LCM> module:<(null)> vendor<(null)> ic<(null)> version<(null)> info<(null)> used<true>

Unable to handle kernel NULL pointer dereference at virtual address 00000000

从log信息来看,是我们刚添加的lcm节点信息问题,lcm节点没有数据,导致空指针异常。

log来源函数

下面是lcm节点信息传入的函数,由于该函数没有检测空指针问题而导致异常。

kernel/drivers/dev_info/dev_info.c


/*********************************************************************************
 * This functions is designed to check if declared already, and add new device if not yet;
 * Input:   devinfo_struct
 * Output:  1 / 0
 * Note: return 1 for there have a same device registed,0 for new device
 * *******************************************************************************/
int devinfo_check_add_device(struct devinfo_struct *dev)
{
    int result = 0;
    unsigned long irqflags;
    struct devinfo_struct *dev_all;
    printk("[DEVINFO] devinfo_check!\n");
    spin_lock_irqsave(&dev_lock, irqflags);
    if(list_empty(&active_devinfo_list) != 1)
    list_for_each_entry(dev_all, &active_devinfo_list, device_link) {
    printk("[DEVINFO] dev type:%s\n",dev->device_type);
    printk("[DEVINFO] dev list type:%s\n",dev_all->device_type);
    if((strcmp(dev_all->device_type,dev->device_type)==0) && (strcmp(dev_all->device_module,dev->device_module)==0) &&
        (strcmp(dev_all->device_vendor,dev->device_vendor)==0) && (strcmp(dev_all->device_ic,dev->device_ic)==0) &&
            (strcmp(dev_all->device_version,dev->device_version)==0) &&(strcmp(dev_all->device_info,dev->device_info)==0))// && shaohui mods here
        // It will be replaced if there is a used device found! Do not mention HOT plug device! 2013.01.31 
        //  (strcmp(dev_all->device_used,dev->device_used)==0))
    {
        if(strcmp(dev_all->device_used,dev->device_used)==0)
        {
            printk("[DEVINFO] find the same device\n");
        }else if(strcmp(dev_all->device_used,DEVINFO_UNUSED)==0)
        {
        //we belive that we find a existed device! del the unexisted one!
            printk("[DEVINFO] find device,but unused state!\n");
            list_del(&dev_all->device_link);
            list_add_tail(&dev->device_link, &active_devinfo_list);
        //  list_replace(&dev_all->device_link, &active_devinfo_list);
            spin_unlock_irqrestore(&dev_lock, irqflags);
            return 0;   
        }else{
        //If a for-existed device is found lost,Do nothing~
            printk("[DEVINFO] find device,but used state!\n");
        }

        spin_unlock_irqrestore(&dev_lock, irqflags);
        return 1;
    }

    }
    list_add_tail(&dev->device_link, &active_devinfo_list);
    spin_unlock_irqrestore(&dev_lock, irqflags);
    return 0;
}

为*#87#工模添加lcm节点信息

下面添加相对应的节点信息,解决空指针异常。

参考TP fl10802添加lcm节点信息

static void lcm_get_params(LCM_PARAMS *params)
{       // Video mode setting       
        params->dsi.intermediat_buffer_num = 2;
        #ifdef SLT_DEVINFO_LCM
        params->module="TXDY450SFWPC-15";
        params->vendor="TONGXINGDA";
        params->ic="FL10802";
        params->info="480*854";
        #endif
        params->dsi.PS=LCM_PACKED_PS_24BIT_RGB888;

添加st7701 lcm节点信息


#if defined(LCT_ADD_TP_VERSION)
static int gtp_info_read_proc(struct file *file, char *buffer, size_t count,  loff_t *ppos)
{

#LCM himax_852xES

        #ifdef SLT_DEVINFO_LCM
        params->module="TXDY450SFWPC-15";
        params->vendor="TONGXINGDA";
        params->ic="FL10802";
        params->info="480*854";
        #endif
...

Wu_Being博客声明:本人博客欢迎转载,请标明博客原文和原链接!谢谢!
《移植mtk平台的lcm过程要点》: http://blog.csdn.net/u014134180/article/details/78124180

通过串口log信息解决无限重启问题——空指针异常

如果你看完这篇博文,觉得对你有帮助,并且愿意付赞助费,那么我会更有动力写下去。

上一篇:【leetcode】日积月累,每日一题--26. 删除有序数组中的重复项(DayDayUp 11)


下一篇:26. 删除排序数组中的重复项