From patchwork Thu Oct 10 06:30:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 3014211 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C26DBF924 for ; Thu, 10 Oct 2013 06:30:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B08A5203AE for ; Thu, 10 Oct 2013 06:30:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBBC0203A3 for ; Thu, 10 Oct 2013 06:30:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753273Ab3JJGah (ORCPT ); Thu, 10 Oct 2013 02:30:37 -0400 Received: from mail-ee0-f49.google.com ([74.125.83.49]:56242 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063Ab3JJGaf (ORCPT ); Thu, 10 Oct 2013 02:30:35 -0400 Received: by mail-ee0-f49.google.com with SMTP id d41so874387eek.8 for ; Wed, 09 Oct 2013 23:30:34 -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=wlGb0zvUYy8qid2KTdNYf2tZ2zRRgUuGIwIXiaAdEWI=; b=KiPXieGoQ7KUFB22TG0Magje140t/If84KB3ocsPiLAbe1CmAspxKb2wfRXAqbsARH BKpmpuUtKdNGIgRkxRgUw9llyfFg6/MMwsPHgp/oxLNhIOQxHWtr3kWLR61Yqq1pVvx+ NZB0fwdJ7KghfTFWCsGkbIotLcpF645qHok8jjUBDw+R2OHiZb+M8XxxkztkrGtGcoW6 Tb7TI9Qw3tblZTzqPa3FCmKzOjbNq2E2HA1wIeKrKjQ28QSIkTI4dIUyFdTMz0E/ArRc aVDViqE+oZJH/Oe2W/bF8pwwQA/WPr8so/Vrm+guRCb7QNAK2yx5ZpoqCCyY3O1PqaYK BtOQ== X-Gm-Message-State: ALoCoQmypWI/sn0+3CUvZQ97mLb9jAIQFCwZMza/xHUgP92PDAxTSsNiuD6dfzpo4Xsh6Xz/t+sl X-Received: by 10.15.99.72 with SMTP id bk48mr18251535eeb.22.1381386634720; Wed, 09 Oct 2013 23:30:34 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id f49sm97482120eec.7.1969.12.31.16.00.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 09 Oct 2013 23:30:34 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Cc: joe@perches.com, Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org Subject: [PATCH v3 3/3] video: xilinxfb: Simplify error path Date: Thu, 10 Oct 2013 08:30:22 +0200 Message-Id: X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381386616.git.michal.simek@xilinx.com> References: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381386616.git.michal.simek@xilinx.com> In-Reply-To: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381386616.git.michal.simek@xilinx.com> References: <631df9a44b366af4129d00f1d4e1d3baad7d4903.1381386616.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=unavailable 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 v3: None 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 c420328..9eedf96 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