From: Nadim Almas <nadim.902@gmail.com>
To: mchehab@kernel.org, gregkh@linuxfoundation.org, Julia.Lawall@lip6.fr
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Staging:media:davinci_vpfe: used devm_kzalloc in place of kzalloc
Date: Wed, 2 Nov 2016 11:43:00 +0530 [thread overview]
Message-ID: <20161102061300.GA4157@gmail.com> (raw)
Switch to resource-managed function devm_kzalloc instead
of kzolloc and remove unneeded kzfree
Also, remove kzfree in probe function and remove
function,vpfe_remove as it is now has nothing to do.
The Coccinelle semantic patch used to make this change is as follows:
/<smpl>
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
<+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
...
?-kzfree(e);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression prb.e;
@@
removefn(...) {
<...
- kzfree(e);
...>
}
//</smpl>
Signed-off-by: Nadim Almas <nadim.902@gmail.com>
---
drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index bf077f8..cd44f0f 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -579,7 +579,7 @@ static int vpfe_probe(struct platform_device *pdev)
struct resource *res1;
int ret = -ENOMEM;
- vpfe_dev = kzalloc(sizeof(*vpfe_dev), GFP_KERNEL);
+ vpfe_dev = devm_kzalloc(&pdev->dev, sizeof(*vpfe_dev), GFP_KERNEL);
if (!vpfe_dev)
return ret;
@@ -681,7 +681,6 @@ static int vpfe_probe(struct platform_device *pdev)
probe_disable_clock:
vpfe_disable_clock(vpfe_dev);
probe_free_dev_mem:
- kzfree(vpfe_dev);
return ret;
}
@@ -702,7 +701,6 @@ static int vpfe_remove(struct platform_device *pdev)
v4l2_device_unregister(&vpfe_dev->v4l2_dev);
media_device_unregister(&vpfe_dev->media_dev);
vpfe_disable_clock(vpfe_dev);
- kzfree(vpfe_dev);
return 0;
}
--
2.7.4
next reply other threads:[~2016-11-02 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 6:13 Nadim Almas [this message]
2016-11-02 6:24 ` [PATCH] Staging:media:davinci_vpfe: used devm_kzalloc in place of kzalloc Julia Lawall
2016-11-22 21:45 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161102061300.GA4157@gmail.com \
--to=nadim.902@gmail.com \
--cc=Julia.Lawall@lip6.fr \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.