From patchwork Tue Nov 18 01:19:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zach Reizner X-Patchwork-Id: 5325101 Return-Path: X-Original-To: patchwork-dri-devel@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 D56379F1E1 for ; Tue, 18 Nov 2014 01:19:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07DA220120 for ; Tue, 18 Nov 2014 01:19:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D4730200E5 for ; Tue, 18 Nov 2014 01:19:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C6E66E15F; Mon, 17 Nov 2014 17:19:46 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f202.google.com (mail-pd0-f202.google.com [209.85.192.202]) by gabe.freedesktop.org (Postfix) with ESMTP id 746866E15F for ; Mon, 17 Nov 2014 17:19:45 -0800 (PST) Received: by mail-pd0-f202.google.com with SMTP id g10so464896pdj.5 for ; Mon, 17 Nov 2014 17:19:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=UnCKBGd3SKNRrOpEmcALCOZJidgP7YcP9zIzs3VVKWo=; b=JdMCMiaDRD63jOUhNnstlUuep5+HaAMXp0uwpcCHCN6RCRVvh8mAQJCDDdlEgqaU5K gL1uJCEvoQjDb7tPMOsAcPCdcpqWt4oHzwW+lbvjReoY4MWY+NHtp9a0AWe1KT8zUpzN Q4xZ0r+UPbztGFf85jr16VfD+SEAXjpYBmdd2+teCXXmEdiFFtfe4R9LbcU8pd7ok30W PqbtJ3/GQgG0+P9WFtlppfN65LIcwyq8WX/sgUWDNvYPCKyu9aXKDxwAyiS1wvbXeGDC oPzD3h3upfZjEK0p/Ldnb79BHiHE84jh/YfesdkSBQB5k68/YSDj7CUEoP1BWk9RGcQB JcUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=UnCKBGd3SKNRrOpEmcALCOZJidgP7YcP9zIzs3VVKWo=; b=Q7Mfgi3zbDrcnwmPNIbdXEyO+kgrtys32X7cqXWbHt+imeMHmDE2afDazl0aho2lLa XzOeT8+3Lm19Dz1q9pU9xfYCFOzbutFCc0LIvejwwwgOLKhMAY/nk8pZMX5oC68/HAfR 68r7hGlS8xjfI6e22qf1Bsvh5piUl/VGwxcbE0cphISZ0nxEBZybDdmLyulU+5mcuYlU y+/Jzv3i3lr+xFOgLm3iHQhiZVmxx8bHV+ndoSVk2CV1yVes9CIau7eC5a4Hf+WGOes/ nh6ttibL0+6NCWIY0Uc95ryi/D3OonBmAAGWG2EkHipBw/1m6jfRrGsuyeJ9WMyGRBa7 eSQg== X-Gm-Message-State: ALoCoQm4KdIACX7zOG4M8X31LnoR7xN2XZnAM9beS0aUsyygzab2fhzTPJmblL2qRbkktGuTt0gd X-Received: by 10.67.4.3 with SMTP id ca3mr70830811pad.23.1416273585241; Mon, 17 Nov 2014 17:19:45 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id lu9si6111373qcb.0.2014.11.17.17.19.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Nov 2014 17:19:45 -0800 (PST) Received: from zachr.mtv.corp.google.com ([172.22.64.53]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id z2PERXsM.1; Mon, 17 Nov 2014 17:19:45 -0800 Received: by zachr.mtv.corp.google.com (Postfix, from userid 201400) id 3206C1826B1; Mon, 17 Nov 2014 17:19:44 -0800 (PST) From: Zach Reizner To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/cirrus: fix leaky driver load error handling Date: Mon, 17 Nov 2014 17:19:41 -0800 Message-Id: <1416273581-1525-1-git-send-email-zachr@google.com> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 MIME-Version: 1.0 Cc: =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Zach Reizner X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID,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 Before this patch, cirrus_device_init could have failed while cirrus_mm_init succeeded and the driver would have reported overall success on load. This patch causes cirrus_device_init to return on the first error encountered. Reviewed-by: Stéphane Marchesin --- drivers/gpu/drm/cirrus/cirrus_main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c index 99c1983..ab7cb54 100644 --- a/drivers/gpu/drm/cirrus/cirrus_main.c +++ b/drivers/gpu/drm/cirrus/cirrus_main.c @@ -179,17 +179,22 @@ int cirrus_driver_load(struct drm_device *dev, unsigned long flags) } r = cirrus_mm_init(cdev); - if (r) + if (r) { dev_err(&dev->pdev->dev, "fatal err on mm init\n"); + goto out; + } r = cirrus_modeset_init(cdev); - if (r) + if (r) { dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r); + goto out; + } dev->mode_config.funcs = (void *)&cirrus_mode_funcs; + + return 0; out: - if (r) - cirrus_driver_unload(dev); + cirrus_driver_unload(dev); return r; }