staging:nvec: Introduce the use of the managed version of kzalloc
authorHimangi Saraogi <[email protected]>
Fri, 7 Mar 2014 16:09:27 +0000 (21:39 +0530)
committerGreg Kroah-Hartman <[email protected]>
Fri, 7 Mar 2014 23:19:36 +0000 (15:19 -0800)
This patch moves shared private data kzalloc to managed devm_kzalloc.
There are no kfree statements associated with this data, so using devm
adds the possibility of the data being freed, if the proble function
fails (if that is possible) or if the remove function succeeds.

Signed-off-by: Himangi Saraogi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/nvec/nvec_ps2.c

index 06dbb02085a936c52ee97bec1787da0ec92179d4..45b2f1308e013216657d7c4a54518eac3188a814 100644 (file)
@@ -106,7 +106,7 @@ static int nvec_mouse_probe(struct platform_device *pdev)
        struct serio *ser_dev;
        char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
 
-       ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL);
+       ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
        if (ser_dev == NULL)
                return -ENOMEM;