From patchwork Wed Oct 9 10:52:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 3008161 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8566F9F243 for ; Wed, 9 Oct 2013 10:52:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90C7A2018A for ; Wed, 9 Oct 2013 10:52:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1C932017C for ; Wed, 9 Oct 2013 10:52:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757214Ab3JIKwb (ORCPT ); Wed, 9 Oct 2013 06:52:31 -0400 Received: from mail-ee0-f53.google.com ([74.125.83.53]:40775 "EHLO mail-ee0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756960Ab3JIKw3 (ORCPT ); Wed, 9 Oct 2013 06:52:29 -0400 Received: by mail-ee0-f53.google.com with SMTP id b15so317090eek.12 for ; Wed, 09 Oct 2013 03:52:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:content-type; bh=9TgpxKE4QQ10iW439Y0ubyHoTJRqvpdqq+nUXD4bNNw=; b=UBYB7+PG4As2ffVPl6Rs9OS57+F8pb7aObpWtUWKYPku5p9IazKy9MMJLWkvq12BAC MNrTBUTuxBzbgfsnBP6Y0CsuiQ+1m4x70mUFj2H54VrIEy0xK/wsfm0mGfjibm7nbUtd hnaNENOReA6si/jjzRDrMXrulwfqCSFHrUMqDfLlGuHQYCnsLq0JlnaxWS7mft1XphFL OfpYtWxTCkT2YTiCHIurJFN2P5p/pGv9c2IR23zEc6hHLYZgLlqcFLSTQ77rnGgkUMCG bxukaE+e8CdeEeAi/Sf7lWOo+vSJuRYd1iu2ykEyVRHqTS7BwL9ZUALt0Nf2RPsp1gRh b7HA== X-Gm-Message-State: ALoCoQmNDN8ZA7a9nOIK5FlsuFdt72e7f8sgr0hYh5ALgNHsk5/4I/EAfOVMY/9BvfmRTE/dwx/R X-Received: by 10.14.5.3 with SMTP id 3mr4139703eek.49.1381315948087; Wed, 09 Oct 2013 03:52:28 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id r48sm87379138eev.14.1969.12.31.16.00.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 09 Oct 2013 03:52:27 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Cc: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org Subject: [PATCH v2 3/3] video: xilinxfb: Simplify error path Date: Wed, 9 Oct 2013 12:52:14 +0200 Message-Id: <9676ce5f1676ad1ebe6a402d4d3d6cdd589bb3fc.1381315928.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381315928.git.michal.simek@xilinx.com> References: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381315928.git.michal.simek@xilinx.com> In-Reply-To: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381315928.git.michal.simek@xilinx.com> References: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381315928.git.michal.simek@xilinx.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, MIME_HEADER_CTYPE_ONLY, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, T_TVD_MIME_NO_HEADERS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP devm_iounmap is called automatically that's why remove it from the code dev_set_drvdata(dev, NULL) is called by generic code after device_release or on probe failure. Signed-off-by: Michal Simek Reviewed-by: Jingoo Han --- Changes in v2: Rebased on git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git for-next drivers/video/xilinxfb.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) -- 1.8.2.3 diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 98c7a6f..7e3036c 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -260,10 +260,9 @@ static int xilinxfb_assign(struct platform_device *pdev, res = platform_get_resource(pdev, IORESOURCE_MEM, 0); drvdata->regs = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(drvdata->regs)) { - rc = PTR_ERR(drvdata->regs); - goto err_region; - } + if (IS_ERR(drvdata->regs)) + return PTR_ERR(drvdata->regs); + drvdata->regs_phys = res->start; } @@ -279,11 +278,7 @@ static int xilinxfb_assign(struct platform_device *pdev, if (!drvdata->fb_virt) { dev_err(dev, "Could not allocate frame buffer memory\n"); - rc = -ENOMEM; - if (drvdata->flags & BUS_ACCESS_FLAG) - goto err_fbmem; - else - goto err_region; + return -ENOMEM; } /* Clear (turn to black) the framebuffer */ @@ -363,11 +358,6 @@ err_cmap: /* Turn off the display */ xilinx_fb_out32(drvdata, REG_CTRL, 0); -err_fbmem: - if (drvdata->flags & BUS_ACCESS_FLAG) - devm_iounmap(dev, drvdata->regs); - -err_region: return rc; } @@ -392,11 +382,9 @@ static int xilinxfb_release(struct device *dev) /* Turn off the display */ xilinx_fb_out32(drvdata, REG_CTRL, 0); - /* Release the resources, as allocated based on interface */ - if (drvdata->flags & BUS_ACCESS_FLAG) - devm_iounmap(dev, drvdata->regs); #ifdef CONFIG_PPC_DCR - else + /* Release the resources, as allocated based on interface */ + if (!(drvdata->flags & BUS_ACCESS_FLAG)) dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); #endif