heaset driver: fixed headset driver fail handling process risks
author邱建斌 <qjb@rock-chips.com>
Wed, 4 Sep 2013 11:40:28 +0000 (19:40 +0800)
committer邱建斌 <qjb@rock-chips.com>
Wed, 4 Sep 2013 11:40:28 +0000 (19:40 +0800)
drivers/headset_observe/rk_headset.c
drivers/headset_observe/rk_headset_irq_hook_adc.c

index 21cac4ee505af1cb0c395b73b0c837ef4463b001..1cf717b1c6f14ee603d988aec2b38d5ce8d446ba 100755 (executable)
@@ -449,7 +449,7 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
        //------------------------------------------------------------------
        if (pdata->Headset_gpio) {
                if(pdata->Headset_gpio == NULL){
-                       dev_err(&pdev->dev,"failed init hook,please full hook_io_init function in board\n");
+                       dev_err(&pdev->dev,"failed init headset,please full hook_io_init function in board\n");
                        goto failed_free_dev;
                }       
                ret = pdata->headset_io_init(pdata->Headset_gpio);
index 3e417b25c2f6566bb2ce54d68392106a8f399295..74ed75a063c10c0de187c402254bd66a499d2ba6 100755 (executable)
@@ -506,9 +506,13 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
        input_set_capability(headset->input_dev, EV_KEY, pdata->hook_key_code);
 //------------------------------------------------------------------
        if (pdata->Headset_gpio) {
-               ret = pdata->headset_io_init(pdata->Headset_gpio, pdata->headset_gpio_info.iomux_name, pdata->headset_gpio_info.iomux_mode);
+               if(pdata->Headset_gpio == NULL){
+                       dev_err(&pdev->dev,"failed init headset,please full hook_io_init function in board\n");
+                       goto failed_free_dev;
+               }
+               ret = pdata->headset_io_init(pdata->Headset_gpio);
                if (ret) 
-                       goto failed_free;
+                       goto failed_free_dev;
 
                headset->irq[HEADSET] = gpio_to_irq(pdata->Headset_gpio);
 
@@ -518,11 +522,11 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
                        headset->irq_type[HEADSET] = IRQF_TRIGGER_LOW|IRQF_ONESHOT;
                ret = request_threaded_irq(headset->irq[HEADSET], NULL,headset_interrupt, headset->irq_type[HEADSET]|IRQF_NO_SUSPEND, "headset_input", NULL);
                if (ret) 
-                       goto failed_free;
+                       goto failed_free_dev;
                enable_irq_wake(headset->irq[HEADSET]);
        }
        else
-               goto failed_free;
+               goto failed_free_dev;
 //------------------------------------------------------------------
        if(pdata->Hook_adc_chn>=0 && 3>=pdata->Hook_adc_chn)
        {
@@ -530,7 +534,7 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
                if(!headset->client) {
                        printk("hook adc register error\n");
                        ret = -EINVAL;
-                       goto failed_free;
+                       goto failed_free_dev;
                }
                setup_timer(&headset->hook_timer,hook_timer_callback, (unsigned long)headset);  
                printk("headset adc default value = %d\n",adc_sync_read(headset->client));