From patchwork Tue Jul 12 06:14:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 967242 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6C6ESDA018536 for ; Tue, 12 Jul 2011 06:14:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276Ab1GLGO1 (ORCPT ); Tue, 12 Jul 2011 02:14:27 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:52019 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751502Ab1GLGO1 (ORCPT ); Tue, 12 Jul 2011 02:14:27 -0400 Received: by ywe9 with SMTP id 9so1807618ywe.19 for ; Mon, 11 Jul 2011 23:14:26 -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=UBHnArfuIFmhEqsHHJCIR6wtnBQYOQiVkJb21UvAj6M=; b=aeaO3wPXpK5nHBfA8IhdvoT0NhK7sEHngU0lIqF3+IhhRo+3kWSxNvJhARje7AIBrc MlbK88qLrLkepi+Fl7bOHNu65wqM7OhAkSvOl3qrg10eo1mBI4CDog6FKF1L2P6IypcZ 65+1xe3PkJCyDkd3NbdA4dPsODuFLhtDmy05g= Received: by 10.236.154.101 with SMTP id g65mr6600814yhk.135.1310451266667; Mon, 11 Jul 2011 23:14:26 -0700 (PDT) Received: from [218.172.239.112] (218-172-239-112.dynamic.hinet.net [218.172.239.112]) by mx.google.com with ESMTPS id o47sm3173318yhn.2.2011.07.11.23.14.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jul 2011 23:14:26 -0700 (PDT) Subject: [PATCH] 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 14:14:21 +0800 Message-ID: <1310451261.13592.4.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 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Jul 2011 06:14:29 +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..c458da0 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 -EIO; } return 0;