From patchwork Thu Apr 8 07:40:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 417792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2DA7C433B4 for ; Thu, 8 Apr 2021 07:40:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 812FA6115B for ; Thu, 8 Apr 2021 07:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbhDHHkV (ORCPT ); Thu, 8 Apr 2021 03:40:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:53596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbhDHHkT (ORCPT ); Thu, 8 Apr 2021 03:40:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 537676113A; Thu, 8 Apr 2021 07:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617867608; bh=wapQTnSFiV1ZtG9q0iplLDk1SJVcJTFJRTo/iVI10D8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jY6qUnRldNElEAzowUqgaGbn3nss6H995XeWKFHfCivqJw5fC+mo3agAPVF6BzVTU esWgX7Vlx/edCn0aXgEITCTtDQYhVRo/xV927aCJcWB7JqN3kOof8zU/3wajQR2FM1 9b9IchiOQV9AZJ4LTUxi1vKWKPLRKzv9ZW5mT/INyOrWxtGYfOdG9I/QObX7Oij3lL AVxDbg9jB0GO/dWsNtSh3VBnrp/yTB44CGhOR9k4Xipux2QLC4EGWBuhSDjMM78dQb l8cWsme+uXUxK/W48W3NZQh0ySry6PYTyxBXIimZPgSNLK4ufND+bWKs+iECzTgm8U daEIo7482tFgA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lUPGn-000jTz-VS; Thu, 08 Apr 2021 09:40:05 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlund?= , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 2/3] media: rdacm21: describe better a truncation Date: Thu, 8 Apr 2021 09:40:03 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As warned by sparse: drivers/media/i2c/rdacm21.c:348:62: warning: cast truncates bits from constant value (300a becomes a) the intention of the code is to get just the lowest 8 bits. So, instead of using a typecast, use a bit and logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/rdacm21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c index dcc21515e5a4..179d107f494c 100644 --- a/drivers/media/i2c/rdacm21.c +++ b/drivers/media/i2c/rdacm21.c @@ -345,7 +345,7 @@ static int ov10640_initialize(struct rdacm21_device *dev) /* Read OV10640 ID to test communications. */ ov490_write_reg(dev, OV490_SCCB_SLAVE0_DIR, OV490_SCCB_SLAVE_READ); ov490_write_reg(dev, OV490_SCCB_SLAVE0_ADDR_HIGH, OV10640_CHIP_ID >> 8); - ov490_write_reg(dev, OV490_SCCB_SLAVE0_ADDR_LOW, (u8)OV10640_CHIP_ID); + ov490_write_reg(dev, OV490_SCCB_SLAVE0_ADDR_LOW, OV10640_CHIP_ID & 0xff); /* Trigger SCCB slave transaction and give it some time to complete. */ ov490_write_reg(dev, OV490_HOST_CMD, OV490_HOST_CMD_TRIGGER);