From patchwork Fri Feb 24 15:42:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 9590629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA64F6020A for ; Fri, 24 Feb 2017 15:49:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF7FC22BF1 for ; Fri, 24 Feb 2017 15:49:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A421A28711; Fri, 24 Feb 2017 15:49:23 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 50A3322BF1 for ; Fri, 24 Feb 2017 15:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751334AbdBXPoI (ORCPT ); Fri, 24 Feb 2017 10:44:08 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36386 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbdBXPmv (ORCPT ); Fri, 24 Feb 2017 10:42:51 -0500 Received: by mail-wr0-f195.google.com with SMTP id o22so1829025wro.3 for ; Fri, 24 Feb 2017 07:42:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eJsuHNT0daC9RcZlV6FoS2Kfr+StsDI+BHsz0JA19rk=; b=IHoM+/ad/Xm5PgWozSjqVBM8r6lxna2vADPeabOXASUm22zSunWAv5fEfQjIVHDQd3 zRSASiLhzEewOUFNm3i9c0Z6wKj/faknuFq8VIEAQJ/U64TuPPss5tPZl45Kext8wseb pt3fF7xUxrn6jZ5IIUUpfxX9BhIacsMj80fsMF5TxwbJtM9yY5KMf0L12squfCi7wYgf 9W7/3vZpKJre7LFjJPLr2E0nwDZUAm/Y+aXF7fvazkg2BAZsce0DA1qY2MNeMrun2mKV Lw/4C9k7uX1ZcqACNNgVcOORuWNbawwAa8X9Ec08wRN2ZGM227rWoGN9dhNCg4yQyGHo AFNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eJsuHNT0daC9RcZlV6FoS2Kfr+StsDI+BHsz0JA19rk=; b=rH9Nb6ZahWZH1yBVoC+SgWgu03G+TkJhSAxtaxbUtPTH0rMSQ5stJS0YtIlcU+g+h+ CqoDNoxj9bBoMLJ+rMyk4UtH04h5ZUHwHDhivqGIvG31zWEUScIRWsUatEIvfsuM2JGZ smvJdQq71SLhO3IMSRFpofao2vUFJTFaCGrFD6ir9QVU8BElWtLI3uqBnFSZlpibo5hM HmeGwWxDaghShXYC+q3sPpHY/RBrDk4Al4uPlfcQEvKzeJPD+NcZsf932jwSQE7mXJCz HR43I4hIy4Q9t+NMea0j/Eo/uR7KmNHRqEjZsKftzQHRvnokcFUsG9S8CJF7crgH1kH1 hmpQ== X-Gm-Message-State: AMke39nVG77Oj4jkyIAEwfTeeyuw2bb4XyDELZ9/e/xjhTUpXOmVrXaD3UXb3Q8xmgpGYQ== X-Received: by 10.223.176.143 with SMTP id i15mr2888511wra.136.1487950969779; Fri, 24 Feb 2017 07:42:49 -0800 (PST) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id w51sm10757350wrc.12.2017.02.24.07.42.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Feb 2017 07:42:49 -0800 (PST) From: yegorslists@googlemail.com To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, andrej.skvortzov@gmail.com, Yegor Yefremov Subject: [PATCH 1/3] tps6507x-ts: update to devm_* API Date: Fri, 24 Feb 2017 16:42:24 +0100 Message-Id: <1487950946-18590-2-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1487950946-18590-1-git-send-email-yegorslists@googlemail.com> References: <1487950946-18590-1-git-send-email-yegorslists@googlemail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yegor Yefremov Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Yegor Yefremov --- drivers/input/touchscreen/tps6507x-ts.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index a340bfc..5bf1ec6 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -226,7 +226,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) */ init_data = tps_board->tps6507x_ts_init_data; - tsc = kzalloc(sizeof(struct tps6507x_ts), GFP_KERNEL); + tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL); if (!tsc) { dev_err(tps6507x_dev->dev, "failed to allocate driver data\n"); return -ENOMEM; @@ -244,7 +244,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) if (!poll_dev) { dev_err(tsc->dev, "Failed to allocate polled input device.\n"); error = -ENOMEM; - goto err_free_mem; + goto err; } tsc->poll_dev = poll_dev; @@ -286,8 +286,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) err_free_polled_dev: input_free_polled_device(poll_dev); -err_free_mem: - kfree(tsc); +err: return error; } @@ -299,8 +298,6 @@ static int tps6507x_ts_remove(struct platform_device *pdev) input_unregister_polled_device(poll_dev); input_free_polled_device(poll_dev); - kfree(tsc); - return 0; }