From patchwork Tue Nov 18 13:47:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 5328851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 215EC9F472 for ; Tue, 18 Nov 2014 13:49:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FFDE200CF for ; Tue, 18 Nov 2014 13:49:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D52E201BC for ; Tue, 18 Nov 2014 13:49:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xqj8E-0005lE-Cz; Tue, 18 Nov 2014 13:47:46 +0000 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xqj8B-0005do-Rh for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 13:47:44 +0000 Received: by mail-pd0-f178.google.com with SMTP id y13so8222222pdi.23 for ; Tue, 18 Nov 2014 05:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sWre5PzgedustsZ5ktfLYXwS/A1sQEqZNycaA9MJaIk=; b=zW0pwqlO9mvVoH4crrgn75VOidSOMU7bjbyo64c8zY8Rw8ldysvUKHLBZXmUVyL4Iz hJ4WnS52oiAtoTy0taA1NZB5j+RIX2EDSamFvfUF8obzER6wYVbcmpBeWQUfsWSOAR7m V5MDnZ/WwFWTLsudUREkgvgY+loTBwLS6UOWcInw4TEKaNz+2mlUYMUYNcnmpWA611/0 k9hu0Ei0yq9/IzZWQ4v865wBdFdPfVuV75jbTHOIi6JxU8OXArBKzl7CODY6MhQSaqRl WXrl6M+k0iKZ5Wsc/7U3xE81eRSzRW1gm+3YNseXid1cVwlnCqcHicT35Hi08xJjDaQl p/Yg== X-Received: by 10.70.134.74 with SMTP id pi10mr11724093pdb.126.1416318440934; Tue, 18 Nov 2014 05:47:20 -0800 (PST) Received: from localhost.localdomain ([122.169.182.195]) by mx.google.com with ESMTPSA id gy5sm37942164pbc.68.2014.11.18.05.47.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 05:47:20 -0800 (PST) From: Sudip Mukherjee To: Wolfgang Grandegger , Marc Kleine-Budde , Michal Simek , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= Subject: [PATCH 2/2] net: can: comparison of unsigned variable Date: Tue, 18 Nov 2014 19:17:07 +0530 Message-Id: <1416318427-28676-2-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1416318427-28676-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1416318427-28676-1-git-send-email-sudipm.mukherjee@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141118_054743_933447_3DB8CF69 X-CRM114-Status: GOOD ( 11.07 ) X-Spam-Score: -0.8 (/) Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sudip Mukherjee , linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 err was of the type u32. it was being compared with < 0, and being an unsigned variable the comparison would have been always false. moreover, err was getting the return value from set_reset_mode() and xcan_set_bittiming(), and both are returning int. Signed-off-by: Sudip Mukherjee Reviewed-by: Michal Simek --- drivers/net/can/xilinx_can.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 72fe96f..67c2dd4 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev) static int xcan_chip_start(struct net_device *ndev) { struct xcan_priv *priv = netdev_priv(ndev); - u32 err, reg_msr, reg_sr_mask; + u32 reg_msr, reg_sr_mask; + int err; unsigned long timeout; /* Check if it is in reset mode */