diff mbox series

Input: olpc_apsp - assign priv->dev earlier

Message ID 20190116094438.1921667-1-lkundrak@v3.sk (mailing list archive)
State Mainlined
Commit ec87da107d11521123beaa9f8e4869c6f54e8df8
Headers show
Series Input: olpc_apsp - assign priv->dev earlier | expand

Commit Message

Lubomir Rintel Jan. 16, 2019, 9:44 a.m. UTC
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).

Cc: stable@vger.kernel.org # v4.18+
Fixes: commit af518342effd ("Input: olpc_apsp - check FIFO status on open(), not probe()")
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/input/serio/olpc_apsp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov Jan. 17, 2019, 7:12 a.m. UTC | #1
On Wed, Jan 16, 2019 at 10:44:38AM +0100, Lubomir Rintel wrote:
> 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).
> 
> Cc: stable@vger.kernel.org # v4.18+
> Fixes: commit af518342effd ("Input: olpc_apsp - check FIFO status on open(), not probe()")
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Applied, thank you.

> ---
>  drivers/input/serio/olpc_apsp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> index 0aece9777087..554f4b8228d2 100644
> --- a/drivers/input/serio/olpc_apsp.c
> +++ b/drivers/input/serio/olpc_apsp.c
> @@ -198,6 +198,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)) {
> @@ -261,7 +263,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);
>  
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 0aece9777087..554f4b8228d2 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -198,6 +198,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)) {
@@ -261,7 +263,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);