From patchwork Fri Jan 11 15:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10758317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D215746 for ; Fri, 11 Jan 2019 15:44:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F244C29748 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E68172982B; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97F5429748 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732120AbfAKPoe (ORCPT ); Fri, 11 Jan 2019 10:44:34 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:59998 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730891AbfAKPoe (ORCPT ); Fri, 11 Jan 2019 10:44:34 -0500 Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EAFC3547; Fri, 11 Jan 2019 16:44:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547221472; bh=VdSpkWvBGePH7GodXkaYOKi1FH9cMGsH7ZJ1VvznOV0=; h=From:To:Cc:Subject:Date:From; b=whyKA9WukzjNULT7oDAkwF8jubUGDMHNPxg0RjLyaBoDuoo3WW9StWai8rkEuW+PR Kk4GtN/wfAtzen0SoT53aPG9Mqei0h/p7bpQ05jgO4GYHLIJlnl6GzWvL2lxwt81M7 RdBoONRQAdxPkV4fE9cBqGILUamPlqsC4luQHTig= From: Kieran Bingham To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham Cc: Steve Longerbeam Subject: [PATCH 2/2] media: i2c: adv748x: Use devm to allocate the device struct Date: Fri, 11 Jan 2019 15:43:45 +0000 Message-Id: <20190111154345.29145-2-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.17.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Steve Longerbeam Switch to devm_kzalloc() when allocating the adv748x device struct. Signed-off-by: Steve Longerbeam --- 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), + 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; }