From patchwork Fri Sep 18 11:06:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 519239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1E4A3140216 for ; Fri, 18 Sep 2015 21:07:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753290AbbIRLHN (ORCPT ); Fri, 18 Sep 2015 07:07:13 -0400 Received: from mga09.intel.com ([134.134.136.24]:65237 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753285AbbIRLHN (ORCPT ); Fri, 18 Sep 2015 07:07:13 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 18 Sep 2015 04:07:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,552,1437462000"; d="scan'208";a="792435393" Received: from black.fi.intel.com ([10.237.72.93]) by fmsmga001.fm.intel.com with ESMTP; 18 Sep 2015 04:07:10 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BB30FF8; Fri, 18 Sep 2015 14:06:39 +0300 (EEST) From: Andy Shevchenko To: linux-i2c@vger.kernel.org, Wolfram Sang , Alexander Sverdlin , Vladimir Zapolskiy Cc: Andy Shevchenko Subject: [PATCH v2 1/1] i2c: core: fix a code to suppress a warning Date: Fri, 18 Sep 2015 14:06:39 +0300 Message-Id: <1442574399-26131-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.5.1 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org There is a warning when compiling i2c-core.c drivers/i2c/i2c-core.c:2561:36: warning: dubious: x | !y Fix it by using a plain bitwise AND since I2C_M_RD is a bit 0 and thus we are on the safe side. Signed-off-by: Andy Shevchenko Reviewed-by: Alexander Sverdlin --- drivers/i2c/i2c-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 5f89f1e..a732107 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -2555,7 +2555,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) static u8 i2c_smbus_msg_pec(u8 pec, struct i2c_msg *msg) { /* The address will be sent first */ - u8 addr = (msg->addr << 1) | !!(msg->flags & I2C_M_RD); + u8 addr = (msg->addr << 1) | (msg->flags & I2C_M_RD); pec = i2c_smbus_pec(pec, &addr, 1); /* The data buffer follows */