From patchwork Wed Oct 22 16:45:10 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: 5135801 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 13E2EC11AC for ; Wed, 22 Oct 2014 16:46:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 29CC8200CA for ; Wed, 22 Oct 2014 16:46:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0401F201EF for ; Wed, 22 Oct 2014 16:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752122AbaJVQqY (ORCPT ); Wed, 22 Oct 2014 12:46:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10922 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbaJVQqQ (ORCPT ); Wed, 22 Oct 2014 12:46:16 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9MGjSiC005300 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Oct 2014 12:45:28 -0400 Received: from shalem.localdomain.com (vpn1-7-162.ams2.redhat.com [10.36.7.162]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9MGjCnU014356; Wed, 22 Oct 2014 12:45:25 -0400 From: Hans de Goede To: Tomi Valkeinen Cc: Stephen Warren , Jean-Christophe Plagniol-Villard , Grant Likely , Rob Herring , Luc Verhaegen , Maxime Ripard , Mike Turquette , David Herrmann , Geert Uytterhoeven , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH v4 4/5] simplefb: add goto error path to probe Date: Wed, 22 Oct 2014 18:45:10 +0200 Message-Id: <1413996311-4287-5-git-send-email-hdegoede@redhat.com> In-Reply-To: <1413996311-4287-1-git-send-email-hdegoede@redhat.com> References: <1413996311-4287-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-8.3 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 While at it update ioremap_wc error return from ENODEV to ENOMEM. Signed-off-by: Luc Verhaegen Acked-by: Stephen Warren Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Acked-by: Geert Uytterhoeven Reviewed-by: Maxime Ripard Reviewed-by: David Herrmann --- drivers/video/fbdev/simplefb.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index ec112c1..cdcf1fe 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 = -ENOMEM; + goto error_fb_release; } info->pseudo_palette = par->palette; @@ -247,14 +247,18 @@ 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)