From patchwork Thu Dec 6 23:35:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 1847391 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id CE765DF2F9 for ; Thu, 6 Dec 2012 23:36:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Tgkz8-0003FS-U7; Thu, 06 Dec 2012 23:36:06 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Tgkz7-0003FK-D6 for spi-devel-general@lists.sourceforge.net; Thu, 06 Dec 2012 23:36:05 +0000 X-ACL-Warn: Received: from mail-we0-f175.google.com ([74.125.82.175]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Tgkz5-0006J7-9y for spi-devel-general@lists.sourceforge.net; Thu, 06 Dec 2012 23:36:05 +0000 Received: by mail-we0-f175.google.com with SMTP id z53so3029656wey.34 for ; Thu, 06 Dec 2012 15:35:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=xVSU3woRYMo3eEmxdFkmZPrAIfzYBiuFZYw85xICBj8=; b=GXvXLYNwgwXVh5Uob6vmMik6m/BwowvqVSSu34gidW7IcqNDGwqqOZYxtDSQnEKqyc VRtd809ZISVm05dmYpZ24v6UWPN/8sF2yTsqjr/4x5/oVA1qYPDbuDuxTS1tJDMuLj8F UAFIc8H+pDFXlazvh/zo4urXX6RR9j++SYgKkYe+bxSiA/Xi1slha5+Jg+Jo/PYk+tuY tAT3sywQCwuAgdawzW0oTDhxPKQi6yVCpyPY+soYrXlF0wVhIpIjXZVBj4JJe48qpc0I gN+xEYgJSh3y6xGYqJCHGIW4lkdTp+w6zDB0mr0oGQNjgGxsshqfcneNC2n7Sr54rSNz DgbA== Received: by 10.216.145.201 with SMTP id p51mr1379001wej.0.1354836957190; Thu, 06 Dec 2012 15:35:57 -0800 (PST) Received: from localhost (host86-180-104-179.range86-180.btcentralplus.com. [86.180.104.179]) by mx.google.com with ESMTPS id y3sm25091648wix.6.2012.12.06.15.35.55 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Dec 2012 15:35:56 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id D76983E0B24; Thu, 6 Dec 2012 23:35:53 +0000 (GMT) From: Grant Likely To: linux-kernel@vger.kernel.org, spi-devel-general@lists.sourceforge.net Subject: [PATCH] spi: Fix comparison of different integer types Date: Thu, 6 Dec 2012 23:35:47 +0000 Message-Id: <1354836947-31078-1-git-send-email-grant.likely@secretlab.ca> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQn4V+hL8ckuYw9VzD6G+jqJNVfFJ50G4Eyah/+B1n9dctMVtiU8nw++Cm1NzzZWvWUQJUDG X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1Tgkz5-0006J7-9y Cc: Mark Brown X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net Fix problem discovered with sparse: + drivers/spi/spi.c:1554:37: sparse: incompatible types in comparison expression (different signedness) drivers/spi/spi.c: In function 'spi_write_then_read': drivers/spi/spi.c:1554:23: warning: comparison of distinct pointer types lacks a cast [enabled by default] The change to SPI_BUFSIZ was introduced in commit b3a223ee2, "spi: Remove SPI_BUFSIZ restriction on spi_write_then_read()" Cc: Mark Brown Reported-by: kbuild test robot Signed-off-by: Grant Likely --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 22c71e2..b370d292 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1551,7 +1551,7 @@ int spi_write_then_read(struct spi_device *spi, * using the pre-allocated buffer or the transfer is too large. */ if ((n_tx + n_rx) > SPI_BUFSIZ || !mutex_trylock(&lock)) { - local_buf = kmalloc(max(SPI_BUFSIZ, n_tx + n_rx), GFP_KERNEL); + local_buf = kmalloc(max((unsigned)SPI_BUFSIZ, n_tx + n_rx), GFP_KERNEL); if (!local_buf) return -ENOMEM; } else {