From patchwork Wed Sep 6 08:10:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 9940051 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 4FA516035F for ; Wed, 6 Sep 2017 08:11:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F0A028B5F for ; Wed, 6 Sep 2017 08:11:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FBB728B60; Wed, 6 Sep 2017 08:11:00 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 90F2D28B40 for ; Wed, 6 Sep 2017 08:10:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbdIFIK5 (ORCPT ); Wed, 6 Sep 2017 04:10:57 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:37710 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbdIFIK2 (ORCPT ); Wed, 6 Sep 2017 04:10:28 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990506AbdIFIK1U9Wm4 (ORCPT ); Wed, 6 Sep 2017 10:10:27 +0200 Date: Wed, 6 Sep 2017 10:10:14 +0200 From: Ladislav Michl To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Sean Young , Andi Shyti Subject: [PATCH 03/10] media: rc: gpio-ir-recv: use devm_rc_allocate_device Message-ID: <20170906081014.jmw256c4q344isql@lenoch> References: <20170906080748.wgxbmunfsu33bd6x@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170906080748.wgxbmunfsu33bd6x@lenoch> User-Agent: NeoMutt/20170113 (1.7.2) 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 Use of devm_rc_allocate_device simplifies error unwinding. Signed-off-by: Ladislav Michl --- drivers/media/rc/gpio-ir-recv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index fd5742b23447..0e0b6988c08e 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -143,7 +143,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) if (!gpio_dev) return -ENOMEM; - rcdev = rc_allocate_device(RC_DRIVER_IR_RAW); + rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW); if (!rcdev) return -ENOMEM; @@ -174,7 +174,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) rc = gpio_request(pdata->gpio_nr, "gpio-ir-recv"); if (rc < 0) - goto err_gpio_request; + return rc; rc = gpio_direction_input(pdata->gpio_nr); if (rc < 0) goto err_gpio_direction_input; @@ -202,8 +202,6 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) err_register_rc_device: err_gpio_direction_input: gpio_free(pdata->gpio_nr); -err_gpio_request: - rc_free_device(rcdev); return rc; }