From patchwork Wed Sep 19 08:30:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 1476351 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 04C923FE79 for ; Wed, 19 Sep 2012 08:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755235Ab2ISIbx (ORCPT ); Wed, 19 Sep 2012 04:31:53 -0400 Received: from na3sys009aog120.obsmtp.com ([74.125.149.140]:57627 "EHLO na3sys009aog120.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753700Ab2ISIbN (ORCPT ); Wed, 19 Sep 2012 04:31:13 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]) (using TLSv1) by na3sys009aob120.postini.com ([74.125.148.12]) with SMTP ID DSNKUFmC0OAOvXWAjggq5pu2LJPo/YW67t37@postini.com; Wed, 19 Sep 2012 01:31:13 PDT Received: by lagy9 with SMTP id y9so510648lag.19 for ; Wed, 19 Sep 2012 01:31:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=bQKK0US6F9xIcG9+fmPYaSS/WbfnF9j/Q6Ay/lXNV18=; b=XrWsqzFo6hlHaXnkaJzvzsfvPxwYWNjI1BebqDLhewH9F1a3kZatMiY0nW16Qd/Vel xsZLPrhkF903KemFDYf/Kqs9kTVoNDlYOa6YSRySDVeauyGJEFV5xBuGqvMlOfpwCk1N 3VrsVVbfqTLM1BxYA0gnbVhQGKyEZIY39aDVjRT8PNTxD7YkJEW71M0edjKkwEIKVLPs FDsXtv6/OUn+65bZFKYuT0JVaWVXcORwEgZNBVRtxUNYfbn3MTI+SFagPsOETnqy4x32 Lp4DhPLoPjywWC8xrOBGP+u7+X9Xmg3t1TVeL47PfOFP2b7b8NZJGohD9SfUGMOEOMka JetA== Received: by 10.112.51.201 with SMTP id m9mr774352lbo.2.1348043470701; Wed, 19 Sep 2012 01:31:10 -0700 (PDT) Received: from localhost.localdomain (a91-156-160-115.elisa-laajakaista.fi. [91.156.160.115]) by mx.google.com with ESMTPS id r8sm589958lba.15.2012.09.19.01.31.07 (version=SSLv3 cipher=OTHER); Wed, 19 Sep 2012 01:31:08 -0700 (PDT) From: Tomi Valkeinen To: archit@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen Subject: [PATCH 5/8] OMAPDSS: handle errors in dss_init_device Date: Wed, 19 Sep 2012 11:30:35 +0300 Message-Id: <1348043438-2624-6-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348043438-2624-1-git-send-email-tomi.valkeinen@ti.com> References: <1348043438-2624-1-git-send-email-tomi.valkeinen@ti.com> X-Gm-Message-State: ALoCoQlVysywNmetOhUseKHddcFEt+s9qWZ2YN5zjKYc5BUCWoZeVi41K1OgsHE+JQSEpbcpGSph Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add error handling to dss_init_device(), which has, for some reason, been missing. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/core.c | 4 +++- drivers/video/omap2/dss/display.c | 23 ++++++++++++++++++----- drivers/video/omap2/dss/dss.h | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 315f557..9315ece 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -358,7 +358,9 @@ static int dss_driver_probe(struct device *dev) dev_name(dev), dssdev->driver_name, dssdrv->driver.name); - dss_init_device(core.pdev, dssdev); + r = dss_init_device(core.pdev, dssdev); + if (r) + return r; force = core.default_display_name && strcmp(core.default_display_name, dssdev->name) == 0; diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 5f09d503..f719010 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -320,26 +320,39 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev, } EXPORT_SYMBOL(omapdss_default_get_timings); -void dss_init_device(struct platform_device *pdev, +int dss_init_device(struct platform_device *pdev, struct omap_dss_device *dssdev) { struct device_attribute *attr; - int i; - int r; + int i, r; /* create device sysfs files */ i = 0; while ((attr = display_sysfs_attrs[i++]) != NULL) { r = device_create_file(&dssdev->dev, attr); - if (r) + if (r) { + for (i = i - 2; i >= 0; i--) { + attr = display_sysfs_attrs[i]; + device_remove_file(&dssdev->dev, attr); + } + DSSERR("failed to create sysfs file\n"); + return r; + } } /* create display? sysfs links */ r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj, dev_name(&dssdev->dev)); - if (r) + if (r) { + while ((attr = display_sysfs_attrs[i++]) != NULL) + device_remove_file(&dssdev->dev, attr); + DSSERR("failed to create sysfs display link\n"); + return r; + } + + return 0; } void dss_uninit_device(struct platform_device *pdev, diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index a977826..98e8273 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -228,7 +228,7 @@ int dss_suspend_all_devices(void); int dss_resume_all_devices(void); void dss_disable_all_devices(void); -void dss_init_device(struct platform_device *pdev, +int dss_init_device(struct platform_device *pdev, struct omap_dss_device *dssdev); void dss_uninit_device(struct platform_device *pdev, struct omap_dss_device *dssdev);