From patchwork Sun Apr 29 19:02:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Benard X-Patchwork-Id: 155764 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9059EB7009 for ; Mon, 30 Apr 2012 05:04:42 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SOZOn-0002bO-2o; Sun, 29 Apr 2012 19:03:09 +0000 Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SOZOQ-0002X0-6Z for linux-arm-kernel@lists.infradead.org; Sun, 29 Apr 2012 19:02:47 +0000 Received: from localhost.localdomain (unknown [82.233.81.124]) by smtp3-g21.free.fr (Postfix) with ESMTP id 23108A625D; Sun, 29 Apr 2012 21:02:39 +0200 (CEST) From: =?UTF-8?q?Eric=20B=C3=A9nard?= To: thierry.reding@avionic-design.de Subject: [PATCH 3/3] pwm: fix pwmchip_add return code test Date: Sun, 29 Apr 2012 21:02:30 +0200 Message-Id: <1335726150-22600-3-git-send-email-eric@eukrea.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1335726150-22600-1-git-send-email-eric@eukrea.com> References: <1335726150-22600-1-git-send-email-eric@eukrea.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org * this should fail only if the value is negative. * else after a pwm is allocated using alloc_pwms, ret contains the number of the pwm and is returned by pwmchip_add so the calling driver (pwm-imx in my case) fails with the following log : mxc_pwm: probe of mxc_pwm.1 failed with error 1 mxc_pwm: probe of mxc_pwm.2 failed with error 2 mxc_pwm: probe of mxc_pwm.3 failed with error 3 Signed-off-by: Eric BĂ©nard --- drivers/pwm/pwm-imx.c | 2 +- drivers/pwm/pwm-samsung.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index d69275f..24384cb 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -201,7 +201,7 @@ static int __devinit imx_pwm_probe(struct platform_device *pdev) } ret = pwmchip_add(&imx->chip); - if (ret) + if (ret < 0) goto err_iounmap; platform_set_drvdata(pdev, imx); diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index 631edf0..c40c37e 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -253,7 +253,7 @@ static int s3c_pwm_probe(struct platform_device *pdev) local_irq_restore(flags); ret = pwmchip_add(&s3c->chip); - if (ret) { + if (ret < 0) { dev_err(dev, "failed to register pwm\n"); goto err_clk_tdiv; }