Input: olpc_apsp - assign priv->dev earlier
authorLubomir Rintel <lkundrak@v3.sk>
Thu, 17 Jan 2019 07:09:31 +0000 (23:09 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 17 Jan 2019 07:19:40 +0000 (23:19 -0800)
The dev field needs to be set when serio_register_port() is called,
because the open callback may use it (in the error handling path).

Fixes: commit af518342effd ("Input: olpc_apsp - check FIFO status on open(), not probe()")
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/serio/olpc_apsp.c

index b36084710f696626b3f9a595f22c357169a30fdf..bae08226e3d95de0e9d2001090b09a4bae29a861 100644 (file)
@@ -195,6 +195,8 @@ static int olpc_apsp_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
+       priv->dev = &pdev->dev;
+
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        priv->base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(priv->base)) {
@@ -248,7 +250,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
                goto err_irq;
        }
 
-       priv->dev = &pdev->dev;
        device_init_wakeup(priv->dev, 1);
        platform_set_drvdata(pdev, priv);