On 03/21/2014 07:18 AM, Andrew Morton wrote:
On Wed, 12 Feb 2014 18:00:38 +0800 <rogera...@realtek.com> wrote:

From: Roger Tseng <rogera...@realtek.com>

Realtek USB memstick host driver provides memstick host support based on the
Realtek USB card reader MFD driver.

...
+static int rtsx_usb_ms_drv_probe(struct platform_device *pdev)
+{
+       struct memstick_host *msh;
+       struct rtsx_usb_ms *host;
+       struct rtsx_ucr *ucr;
+       int err;
+
+       ucr = usb_get_intfdata(to_usb_interface(pdev->dev.parent));
+       if (!ucr)
+               return -ENXIO;
+
+       dev_dbg(&(pdev->dev),
+                       "Realtek USB Memstick controller found\n");
+
+       msh = memstick_alloc_host(sizeof(*host), &pdev->dev);
+       if (!msh)
+               return -ENOMEM;
+
+       host = memstick_priv(msh);
+       host->ucr = ucr;
+       host->msh = msh;
+       host->pdev = pdev;
+       host->power_mode = MEMSTICK_POWER_OFF;
+       platform_set_drvdata(pdev, host);
+
+       mutex_init(&host->host_mutex);
+       INIT_WORK(&host->handle_req, rtsx_usb_ms_handle_req);
+
+       init_completion(&host->detect_ms_exit);
+       host->detect_ms = kthread_create(rtsx_usb_detect_ms_card, host,
+                       "rtsx_usb_ms_%d", pdev->id);
+       if (IS_ERR(host->detect_ms)) {
+               dev_dbg(&(pdev->dev),
+                               "Unable to create polling thread.\n");
+               err = PTR_ERR(host->detect_ms);
+               goto err_out;
+       }
+
+       msh->request = rtsx_usb_ms_request;
+       msh->set_param = rtsx_usb_ms_set_param;
+       msh->caps = MEMSTICK_CAP_PAR4;
+
+       pm_runtime_enable(&pdev->dev);
+       err = memstick_add_host(msh);
+       if (err)
+               goto err_out;

Isn't that kernel thread still running?

The kernel thread is created(kthread_create) but should not start before the "goto".

Did I miss anything or will it be better to move all kthread things after here?
+       wake_up_process(host->detect_ms);
+       return 0;
+err_out:
+       memstick_free_host(msh);
+       return err;
+}

Best regards,
Roger Tseng
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to