From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: Re: [PATCH 2/2] media: i2c: adv748x: Use devm to allocate the device struct
Date: Fri, 11 Jan 2019 16:08:22 +0000 [thread overview]
Message-ID: <52412a2d-bf8a-916f-96f9-8f4af93a18c7@ideasonboard.com> (raw)
In-Reply-To: <20190111154345.29145-2-kieran.bingham+renesas@ideasonboard.com>
Hi Steve,
On 11/01/2019 15:43, Kieran Bingham wrote:
> From: Steve Longerbeam <steve_longerbeam@mentor.com>
Thank you for the patch, (which was forwarded to me from the BSP team)
> Switch to devm_kzalloc() when allocating the adv748x device struct.
>
> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
> ---
> drivers/media/i2c/adv748x/adv748x-core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
> index 097e5c3a8e7e..4af2ae8fcc0a 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -774,7 +774,8 @@ static int adv748x_probe(struct i2c_client *client,
> if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
> return -EIO;
>
> - state = kzalloc(sizeof(struct adv748x_state), GFP_KERNEL);
> + state = devm_kzalloc(&client->dev, sizeof(struct adv748x_state),
I would instead use:
state = devm_kzalloc(&client->dev, sizeof(*state));
I will submit a v2 with this change made.
--
Regards
Kieran
> + GFP_KERNEL);
> if (!state)
> return -ENOMEM;
>
> @@ -861,7 +862,6 @@ static int adv748x_probe(struct i2c_client *client,
> adv748x_dt_cleanup(state);
> err_free_mutex:
> mutex_destroy(&state->mutex);
> - kfree(state);
>
> return ret;
> }
> @@ -880,8 +880,6 @@ static int adv748x_remove(struct i2c_client *client)
> adv748x_dt_cleanup(state);
> mutex_destroy(&state->mutex);
>
> - kfree(state);
> -
> return 0;
> }
>
>
next prev parent reply other threads:[~2019-01-11 16:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 15:43 [PATCH 2/2] media: i2c: adv748x: Use devm to allocate the device struct Kieran Bingham
2019-01-11 16:08 ` Kieran Bingham [this message]
2019-01-11 18:23 ` Steve Longerbeam
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=52412a2d-bf8a-916f-96f9-8f4af93a18c7@ideasonboard.com \
--to=kieran.bingham+renesas@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=steve_longerbeam@mentor.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).