From patchwork Mon Dec 1 22:15:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zach Reizner X-Patchwork-Id: 5415611 Return-Path: X-Original-To: patchwork-dri-devel@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 57D3EBEEA8 for ; Mon, 1 Dec 2014 22:16:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C35A2026F for ; Mon, 1 Dec 2014 22:16:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8144D2026C for ; Mon, 1 Dec 2014 22:16:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 145416E163; Mon, 1 Dec 2014 14:16:35 -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 183266E039 for ; Mon, 1 Dec 2014 14:16:33 -0800 (PST) Received: by mail-pd0-f202.google.com with SMTP id w10so1472744pde.5 for ; Mon, 01 Dec 2014 14:16:32 -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=zHnc222/746N5XSsyC2uIMujw5kSHkKU6qOGH44voMw=; b=ngI5Yarf+jjkK5Rkf0BjnxqGVT4jHo6VsXH1/oS1ZYzWYlb6HfZXvcSmxMAbZyNS3N BIU7MrFXVlkbYMqok2LIoBnfh6cdK6pU2YFVo+ScHWRMOfXt4ftCYa2Vqc2r6lNeyRfb XFI0Y5NHixdGqGXfp9vBw4HFAHyeLWYxhpgoQTwuyAqgpJyFP9rdAHrGkRTZtKputW+o aNTBqDgTo/J/V19xzOLSBtxc/1IkEnCTovM5ax5Wu1jNu9fdab25sfSxWJsn+ee8XkbI c/6Fuj9UbprQCD0J5lqJzedEDAWKev6QHeIrRmq4n6L5PPfWP8ysSFsinS6OfTaHPn66 v8aQ== 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=zHnc222/746N5XSsyC2uIMujw5kSHkKU6qOGH44voMw=; b=YHXr0RKqJBVTleYyA/Tt4j393r/kMufZRQZ3ST1fF3V2FqoDffyS4j+5QCIfCC6fo/ PIIZCXhe8LsZAJFGGQfi7iSYXb9h2elGS4GKkMYJe8ZRGX/HXPrg1nOkLJJFZA+x8Jg4 OIEo0NBQQ4CMCHoWQ4ccO8Dff8SLe7+a60BNT867jZf1M5m0rTX6cmnAXOcguadJ2tDu XdQjC1uGfIvb9f1LS7jieT5eFPv0+R5IM7IGaGr432tExXBzLC7e9ea173f9p5uV9/w9 wkuU3cLGSugIdzx3D4xGu9VHsCli/+20kbf5Cor2u8NbJGmvBh2ATg7gMWxYN5WeY0LC xg2Q== X-Gm-Message-State: ALoCoQnqqMVw1KkGoT4neLmnxYpU0c7pREVsmJCdAVXNVL2CxIbd78NNBaW6c64OSQrU+CsiiUfm X-Received: by 10.66.250.165 with SMTP id zd5mr57353257pac.27.1417472192797; Mon, 01 Dec 2014 14:16:32 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id 5si756666yhd.6.2014.12.01.14.16.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Dec 2014 14:16:32 -0800 (PST) Received: from zachr.mtv.corp.google.com ([172.22.64.53]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id kM6WyeMe.1; Mon, 01 Dec 2014 14:16:32 -0800 Received: by zachr.mtv.corp.google.com (Postfix, from userid 201400) id B801318053F; Mon, 1 Dec 2014 14:16:31 -0800 (PST) From: Zach Reizner To: dri-devel@lists.freedesktop.org, David Airlie Subject: [PATCH v2] drm/cirrus: fix leaky driver load error handling Date: Mon, 1 Dec 2014 14:15:51 -0800 Message-Id: <1417472151-3559-1-git-send-email-zachr@google.com> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c 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_mm_init could have failed while cirrus_modeset_init succeeded and the driver would have reported overall success on load. This patch causes cirrus_driver_load to return on the first error encountered. Reviewed-by: Stéphane Marchesin Signed-off-by: Zach Reizner Reviewed-by: Sean Paul --- 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; }