From patchwork Sun Sep 28 12:43:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 4991691 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 847DABEEA6 for ; Sun, 28 Sep 2014 12:44:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B335720251 for ; Sun, 28 Sep 2014 12:44:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFD0A20219 for ; Sun, 28 Sep 2014 12:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753940AbaI1MoS (ORCPT ); Sun, 28 Sep 2014 08:44:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17493 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753903AbaI1MoR (ORCPT ); Sun, 28 Sep 2014 08:44:17 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8SChmV8015462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 28 Sep 2014 08:43:48 -0400 Received: from shalem.localdomain.com (vpn1-4-237.ams2.redhat.com [10.36.4.237]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8SChdam014107; Sun, 28 Sep 2014 08:43:46 -0400 From: Hans de Goede To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Grant Likely , Rob Herring Cc: Luc Verhaegen , Maxime Ripard , Mike Turquette , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH 3/4] simplefb: add goto error path to probe Date: Sun, 28 Sep 2014 14:43:37 +0200 Message-Id: <1411908218-20947-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1411908218-20947-1-git-send-email-hdegoede@redhat.com> References: <1411908218-20947-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From: Luc Verhaegen Signed-off-by: Luc Verhaegen Signed-off-by: Hans de Goede --- drivers/video/fbdev/simplefb.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index ec112c1..b7d5c08 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -220,8 +220,8 @@ static int simplefb_probe(struct platform_device *pdev) info->apertures = alloc_apertures(1); if (!info->apertures) { - framebuffer_release(info); - return -ENOMEM; + ret = -ENOMEM; + goto error_fb_release; } info->apertures->ranges[0].base = info->fix.smem_start; info->apertures->ranges[0].size = info->fix.smem_len; @@ -231,8 +231,8 @@ static int simplefb_probe(struct platform_device *pdev) info->screen_base = ioremap_wc(info->fix.smem_start, info->fix.smem_len); if (!info->screen_base) { - framebuffer_release(info); - return -ENODEV; + ret = -ENODEV; + goto error_fb_release; } info->pseudo_palette = par->palette; @@ -247,14 +247,20 @@ static int simplefb_probe(struct platform_device *pdev) ret = register_framebuffer(info); if (ret < 0) { dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); - iounmap(info->screen_base); - framebuffer_release(info); - return ret; + goto error_unmap; } dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); return 0; + + error_unmap: + iounmap(info->screen_base); + + error_fb_release: + framebuffer_release(info); + + return ret; } static int simplefb_remove(struct platform_device *pdev)