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: 1476341 Return-Path: X-Original-To: patchwork-linux-fbdev@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 DB3F23FE65 for ; Wed, 19 Sep 2012 08:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755213Ab2ISIbv (ORCPT ); Wed, 19 Sep 2012 04:31:51 -0400 Received: from na3sys009aog119.obsmtp.com ([74.125.149.246]:37286 "EHLO na3sys009aog119.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753496Ab2ISIbN (ORCPT ); Wed, 19 Sep 2012 04:31:13 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]) (using TLSv1) by na3sys009aob119.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 y9so510647lag.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=I/h2vviynEtLhg1r4oNcmbv6rLyvehxQREa90j+1HnbKOrlxk8zHTLGRi6UKVmg66P mQzKFphlkAPznFqWncXghxtVwm1wX+07AAGmH6m88cyOTPcwl6ilrYCtJlmmmb8jROEG mHOUMzaIf5ufZqQFxcDPhjK4x5z1fJ+Evg+iWFkiOlfW7tj5U0Um9wWfG6lzaQHY8fOx DE3M7SAQoNSPgtc/EHdVuEg1TdSQfujlpqAf0za2xCweq1QQoytM4KUSPOxfSlNY9qVD iwJIQx3UQOLKOB+4K29hw2Q0zyqN12X2z2fa3+dvqb/itDeAuSzGuPLuVQSMfzJvG67x Uvqg== 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: ALoCoQmqg3RBp+AU5i2OL1WV5qXs2Psh7Sz9LowVsYB365qcHEewlB+ob4uixJASnfPes5ZiL4KB Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@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);