From patchwork Wed Aug 13 07:17:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Verhaegen X-Patchwork-Id: 4716571 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 AB298C033A for ; Wed, 13 Aug 2014 07:17:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D00FA201BC for ; Wed, 13 Aug 2014 07:17:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7C3C201B9 for ; Wed, 13 Aug 2014 07:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751122AbaHMHRi (ORCPT ); Wed, 13 Aug 2014 03:17:38 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:48059 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750968AbaHMHRi (ORCPT ); Wed, 13 Aug 2014 03:17:38 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3hY2L82YfRz3hhqk; Wed, 13 Aug 2014 09:17:36 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3hY2L82BHpz7S6QK; Wed, 13 Aug 2014 09:17:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id dJX94FWMhYfJ; Wed, 13 Aug 2014 09:17:35 +0200 (CEST) Received: from quoth.libv (ppp-188-174-145-148.dynamic.mnet-online.de [188.174.145.148]) by mail.mnet-online.de (Postfix) with ESMTP; Wed, 13 Aug 2014 09:17:35 +0200 (CEST) From: Luc Verhaegen To: linux-fbdev@vger.kernel.org Cc: Stephen Warren , Tomi Valkeinen , Jean-Christophe Plagniol-Villard , Maxime Ripard , linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] simplefb: add goto error path to probe Date: Wed, 13 Aug 2014 09:17:17 +0200 Message-Id: <1407914239-12054-3-git-send-email-libv@skynet.be> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1407914239-12054-1-git-send-email-libv@skynet.be> References: <1407914239-12054-1-git-send-email-libv@skynet.be> 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Signed-off-by: Luc Verhaegen Reviewed-by: David Herrmann --- drivers/video/fbdev/simplefb.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 32be590..72a4f20 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 = (void *) 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)