From patchwork Tue Jul 12 08:43:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 967602 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6C8hNPu031275 for ; Tue, 12 Jul 2011 08:43:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751750Ab1GLInW (ORCPT ); Tue, 12 Jul 2011 04:43:22 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:56031 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637Ab1GLInV (ORCPT ); Tue, 12 Jul 2011 04:43:21 -0400 Received: by yxi11 with SMTP id 11so1850713yxi.19 for ; Tue, 12 Jul 2011 01:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=EeDe9zLHK8YKUyXNC4A/HXpSX4BaZv6pfpRKYDcWQ2k=; b=dh6Wxk2H2+9aFzG3X+io1HO1ZvLZwWJC1kWRfahDq/wpydPn8m9Ybu72sidvS0x8n5 rsY2dIy8SABerR0aRY7zROcQyo68TPyOarRmBQJsxvS4LVUxzWZh9qzqQIlPRGTARnS/ 3ScqfN+wC3rGMxPVy6XfUnwv1NIV6e1LX99ZE= Received: by 10.236.78.193 with SMTP id g41mr6679403yhe.468.1310460200703; Tue, 12 Jul 2011 01:43:20 -0700 (PDT) Received: from [218.172.239.202] (218-172-239-202.dynamic.hinet.net [218.172.239.202]) by mx.google.com with ESMTPS id j65sm762710yhm.68.2011.07.12.01.43.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jul 2011 01:43:19 -0700 (PDT) Subject: [PATCH v2] Input: cy8ctmg110_ts - fix checking return value of i2c_master_send From: Axel Lin To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Samuli Konttila , linux-input@vger.kernel.org Date: Tue, 12 Jul 2011 16:43:13 +0800 Message-ID: <1310460193.2028.1.camel@phoenix> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 12 Jul 2011 08:43:23 +0000 (UTC) i2c_master_send returns negative errno, or else the number of bytes written. Signed-off-by: Axel Lin --- drivers/input/touchscreen/cy8ctmg110_ts.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 4481cc5..d7afa20 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c @@ -84,9 +84,9 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg, memcpy(i2c_data + 1, value, len); ret = i2c_master_send(client, i2c_data, len + 1); - if (ret != 1) { + if (ret != (len + 1)) { dev_err(&client->dev, "i2c write data cmd failed\n"); - return ret ? ret : -EIO; + return ret < 0 ? ret : -EIO; } return 0;