From patchwork Fri Oct 3 11:52:04 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: 5021941 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 52ACDC11AB for ; Fri, 3 Oct 2014 11:52:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 721DA201F2 for ; Fri, 3 Oct 2014 11:52:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9279A201D3 for ; Fri, 3 Oct 2014 11:52:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbaJCLww (ORCPT ); Fri, 3 Oct 2014 07:52:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8693 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751663AbaJCLwv (ORCPT ); Fri, 3 Oct 2014 07:52:51 -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 s93BqMiJ001891 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Oct 2014 07:52:22 -0400 Received: from shalem.localdomain.com (vpn1-7-74.ams2.redhat.com [10.36.7.74]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s93Bq6ee016813; Fri, 3 Oct 2014 07:52:19 -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 , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH v2 4/5] simplefb: add goto error path to probe Date: Fri, 3 Oct 2014 13:52:04 +0200 Message-Id: <1412337125-14388-5-git-send-email-hdegoede@redhat.com> In-Reply-To: <1412337125-14388-1-git-send-email-hdegoede@redhat.com> References: <1412337125-14388-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Acked-by: Stephen Warren Reviewed-by: Hans de Goede 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)