From patchwork Thu Sep 12 05:54:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 2876131 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 5EF2C9F486 for ; Thu, 12 Sep 2013 05:55:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CE2A2022D for ; Thu, 12 Sep 2013 05:55:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A58BB2010C for ; Thu, 12 Sep 2013 05:55:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755356Ab3ILFyn (ORCPT ); Thu, 12 Sep 2013 01:54:43 -0400 Received: from mail-ee0-f52.google.com ([74.125.83.52]:41921 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753327Ab3ILFyl (ORCPT ); Thu, 12 Sep 2013 01:54:41 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so5006073eek.39 for ; Wed, 11 Sep 2013 22:54:40 -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=eAYUILi3m8bCDsRltRpaeRpBhnsqTp5woAWd9E3y/b0=; b=ThGAumDQ++uwVLenwsshYQZo1QQOU6pM+4tjykiJ4bSMPd/R7qFbunDots7/7WmT3M SD7WcvqF2gxSPL/ene/VwBpWJajJdLfWnakDBVV8CHqO84HydTRJeMKlrs/Jl8Z4FJPG ui3LNrrqZG6wANPbZlunFISwjJTH64QfAj1f4VxCWbwzdutD3DWZ+nLRkxHdEm153EZx joeuPz0FMoA2TB/1OqUPcuEeI7Vvmf2E1sJQJrCHVTKX0kWF6r94HfEXEEwk9BusCzqa 6bT2kX+6KaQ/x9fstnHhQLJPllt3SyMqw/wXsVKDxZJ+mXIhOfSwXY7YAF2ej2vJmTqI lqog== X-Gm-Message-State: ALoCoQmd6mpfOQjG7aW+ANi1IWDM8DFScdrxgEEi5smfzT7KFS4FZ0jeeKDP+okTphEzQ4Lu2osE X-Received: by 10.14.194.131 with SMTP id m3mr8191397een.45.1378965280321; Wed, 11 Sep 2013 22:54:40 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id p5sm2748984eeg.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 11 Sep 2013 22:54:39 -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 3/3] video: xilinxfb: Simplify error path Date: Thu, 12 Sep 2013 07:54:34 +0200 Message-Id: <940bbdfc5c67282ab461b9c82b55f18fc34c959d.1378965270.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> References: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> In-Reply-To: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> References: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.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=-7.1 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 --- drivers/video/xilinxfb.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) -- 1.8.2.3 diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index fd9c430..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,13 +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: - dev_set_drvdata(dev, NULL); - return rc; } @@ -394,16 +382,12 @@ 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 - dev_set_drvdata(dev, NULL); - return 0; }