From: Sebastian Reichel <sre@kernel.org>
To: Hans Verkuil <hans.verkuil@cisco.com>, linux-media@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Sebastian Reichel <sre@kernel.org>
Subject: [RFCv2 3/8] [media] si4713: use managed memory allocation
Date: Tue, 21 Oct 2014 17:07:02 +0200 [thread overview]
Message-ID: <1413904027-16767-4-git-send-email-sre@kernel.org> (raw)
In-Reply-To: <1413904027-16767-1-git-send-email-sre@kernel.org>
Introduce the usage of managed memory allocation to
simplify the code slightly.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
drivers/media/radio/si4713/si4713.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/media/radio/si4713/si4713.c b/drivers/media/radio/si4713/si4713.c
index e560a7e..efc5d6b 100644
--- a/drivers/media/radio/si4713/si4713.c
+++ b/drivers/media/radio/si4713/si4713.c
@@ -1450,7 +1450,7 @@ static int si4713_probe(struct i2c_client *client,
struct v4l2_ctrl_handler *hdl;
int rval, i;
- sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
+ sdev = devm_kzalloc(&client->dev, sizeof(*sdev), GFP_KERNEL);
if (!sdev) {
dev_err(&client->dev, "Failed to alloc video device.\n");
rval = -ENOMEM;
@@ -1467,7 +1467,7 @@ static int si4713_probe(struct i2c_client *client,
} else {
rval = PTR_ERR(sdev->gpio_reset);
dev_err(&client->dev, "Failed to request gpio: %d\n", rval);
- goto free_sdev;
+ goto exit;
}
sdev->vdd = devm_regulator_get_optional(&client->dev, "vdd");
@@ -1615,8 +1615,6 @@ free_irq:
free_irq(client->irq, sdev);
free_ctrls:
v4l2_ctrl_handler_free(hdl);
-free_sdev:
- kfree(sdev);
exit:
return rval;
}
@@ -1635,7 +1633,6 @@ static int si4713_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
- kfree(sdev);
return 0;
}
--
2.1.1
next prev parent reply other threads:[~2014-10-21 15:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 15:06 [RFCv2 0/8] [media] si4713 DT binding Sebastian Reichel
2014-10-21 15:07 ` [RFCv2 1/8] [media] si4713: switch to devm regulator API Sebastian Reichel
[not found] ` <1413904027-16767-2-git-send-email-sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-11-11 11:07 ` Mauro Carvalho Chehab
2014-11-11 11:07 ` Mauro Carvalho Chehab
2014-11-11 14:33 ` Sebastian Reichel
2014-11-11 17:59 ` Hans Verkuil
[not found] ` <54624E83.1060404-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2014-11-11 22:12 ` Mauro Carvalho Chehab
2014-11-11 22:12 ` Mauro Carvalho Chehab
2014-10-21 15:07 ` [RFCv2 2/8] [media] si4713: switch reset gpio to devm_gpiod API Sebastian Reichel
2014-10-21 15:07 ` Sebastian Reichel [this message]
2014-10-21 15:07 ` [RFCv2 4/8] [media] si4713: use managed irq request Sebastian Reichel
2014-10-21 15:07 ` [RFCv2 5/8] [media] si4713: add device tree support Sebastian Reichel
[not found] ` <1413904027-16767-6-git-send-email-sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-11-04 21:47 ` Sakari Ailus
2014-11-04 21:47 ` Sakari Ailus
2014-11-10 20:58 ` Sebastian Reichel
2014-10-21 15:07 ` [RFCv2 6/8] [media] si4713: add DT binding documentation Sebastian Reichel
2014-10-21 15:07 ` [RFCv2 7/8] ARM: OMAP2: RX-51: update si4713 platform data Sebastian Reichel
2014-10-21 15:07 ` [RFCv2 8/8] [media] si4713: cleanup " Sebastian Reichel
2014-11-07 12:49 ` [RFCv2 0/8] [media] si4713 DT binding Hans Verkuil
2014-11-10 11:06 ` Hans Verkuil
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=1413904027-16767-4-git-send-email-sre@kernel.org \
--to=sre@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=hans.verkuil@cisco.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=tony@atomide.com \
/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.