From patchwork Fri Oct 5 21:33:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Senna Tschudin X-Patchwork-Id: 189606 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C31142C0086 for ; Sat, 6 Oct 2012 07:35:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757185Ab2JEVd2 (ORCPT ); Fri, 5 Oct 2012 17:33:28 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:63682 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753647Ab2JEVd1 (ORCPT ); Fri, 5 Oct 2012 17:33:27 -0400 Received: by mail-wi0-f172.google.com with SMTP id hq12so1358317wib.1 for ; Fri, 05 Oct 2012 14:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=/7iPylo1FBAWKeo06grrrjVxzZFhQtHbTR4bo1EG9Qo=; b=uVZfu31WyjeIBlCxb3rcx9iYxIDwYGRqWa8Uk3qswUe3QJe7CwZPnP1jthrkYsW7nB p/t6RcBsHK9Ui3pOIQWDZGVdDqGc4m5NI5BIOpV/GyxLWYnEy/78B9/z9c1Eo6lYtzAW /SZFt9B8/34AfAyyTMwvs6fSDXLc+mycT/a1p4eesngD4D2N5eY1xRukCRO8N0Q4ZZW/ UCff/m9VUF8H9EH4L0GC4Xzwq4joJP7E5hy2uZs0kza5xdYFh76wynt+fQBCncMXYYEa EFpeZv90WqPpzUAekHbc6Th1BA2r71WpC+ZdYpQp0lPm5VnzSNMN/MIgfj/Rak7hVbKm I22g== Received: by 10.216.193.158 with SMTP id k30mr6125098wen.89.1349472805811; Fri, 05 Oct 2012 14:33:25 -0700 (PDT) Received: from ace.home ([37.175.200.243]) by mx.google.com with ESMTPS id v3sm5048951wiy.5.2012.10.05.14.33.24 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 14:33:25 -0700 (PDT) From: Peter Senna Tschudin To: samuel@sortiz.org Cc: irda-users@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Peter Senna Tschudin Subject: [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code Date: Fri, 5 Oct 2012 23:33:02 +0200 Message-Id: <1349472786-10921-1-git-send-email-peter.senna@gmail.com> X-Mailer: git-send-email 1.7.11.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Peter Senna Tschudin The function sh_irda_probe() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to err_mem_4:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller function to notice the error. This patch fixes the error case that do not return negative value. This was found by Coccinelle, but the code change was made by hand. This patch is not robot generated. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Peter Senna Tschudin --- Change from V1: Updated commit message. See: http://www.kernelhub.org/?p=2&msg=139319 drivers/net/irda/sh_irda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/irda/sh_irda.c b/drivers/net/irda/sh_irda.c index eb315b8..4b746d9 100644 --- a/drivers/net/irda/sh_irda.c +++ b/drivers/net/irda/sh_irda.c @@ -808,8 +808,8 @@ static int __devinit sh_irda_probe(struct platform_device *pdev) goto err_mem_4; platform_set_drvdata(pdev, ndev); - - if (request_irq(irq, sh_irda_irq, IRQF_DISABLED, "sh_irda", self)) { + err = request_irq(irq, sh_irda_irq, IRQF_DISABLED, "sh_irda", self); + if (err) { dev_warn(&pdev->dev, "Unable to attach sh_irda interrupt\n"); goto err_mem_4; }