Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1276401ybh; Thu, 16 Jul 2020 07:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhRtUMmff9zSs/YTo/26VLSqtq97FH9Oiv++o2JY8EOdzlzBpdt/qu/KvZX2uhfxBGVDvf X-Received: by 2002:aa7:db57:: with SMTP id n23mr4754893edt.235.1594911161369; Thu, 16 Jul 2020 07:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594911161; cv=none; d=google.com; s=arc-20160816; b=k3I2wgtMqs5A+GuzN/dzfxgnEAWc3/VHx23shu5sKPyRoS+jxZ7FVCeOONHzbG2jQ3 6yRssrCyO8T/fyRJT9WxGhVTRgg1ucPeqkr7iKXlsfObxkC2B38xgFa7guAmZ8tw8l67 z8hBt21CqjFMWDp9daEd/TKzzjOMZNps9YKBS1IjTZKU9thQZ9wnA6J5sVNRmIbv1a1K iRC//ZxpiUQAelHLZ4t6vIjhFxxm/HZC7kZ8EN7EHFSGZxbm2ykcY7Wx1XXDv+cYk/hB ng9bhIVodIDFwjVjWA3W7xj9e8QfbhjmSQh5taCgfhU7Y6Klp8LWQZqOiQr1KdAmChSB ga2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qfZSUpPjlBty7aCjJ/Crk9uzW4rl11z6CN2oNGRkC94=; b=BbWcWpBe1EZApYw/OiUH2z0a9lvwP1whThyd/3OLKVGvcOweZa7wh3EymUDIZhsh5C TenWb84xdfyPhZaPU3UFdpLhwdBGyvsDdi4FvKEB64/74Y8AIBKbyVNgK4lTiNgxyltc GdStbbJLMoW5OnyKZ6Vqyh1qya0rymuUKcOMV0HUNPDvzA4giZ6kvBlQiXoHXQb2LFGi AnvTdkRBvYg79Lql0Lr2b4uddv08tub4IxobOvrRgXezum9EpOTbPbTTx/2akujh9x/I Ec9qXWn4525Ad7ShlwmJB9BxWulQk4Xt/cUZlxQe5Oh8/8yCECULZPoaNfrofVeIKvsY nyhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qq21si3225630ejb.570.2020.07.16.07.52.17; Thu, 16 Jul 2020 07:52:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728771AbgGPOvm (ORCPT + 99 others); Thu, 16 Jul 2020 10:51:42 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58566 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728551AbgGPOvl (ORCPT ); Thu, 16 Jul 2020 10:51:41 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jw5EY-0008Au-F2; Thu, 16 Jul 2020 14:51:38 +0000 From: Colin King To: Mauro Carvalho Chehab , Sakari Ailus , linux-media@vger.kernel.org, devel@driverdev.osuosl.org Cc: kernel-janitors@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH] media: atomisp: fix mask and shift operation on ISPSSPM0 Date: Thu, 16 Jul 2020 15:51:38 +0100 Message-Id: <20200716145138.1708693-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently the check on bits 25:24 on ISPSSPM0 is always 0 because the mask and shift operations are incorrect. Fix this by shifting by MRFLD_ISPSSPM0_ISPSSS_OFFSET (24 bits right) and then masking with RFLD_ISPSSPM0_ISPSSC_MASK (0x03) to get the appropriate 2 bits to check. Addresses-Coverity: ("Operands don't affect result") Fixes: 0f441fd70b1e ("media: atomisp: simplify the power down/up code") Signed-off-by: Colin Ian King --- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index d36809a0182c..a59d11aa232d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -755,7 +755,7 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable) /* Wait until ISPSSPM0 bit[25:24] shows the right value */ iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, &tmp); - tmp = (tmp & MRFLD_ISPSSPM0_ISPSSC_MASK) >> MRFLD_ISPSSPM0_ISPSSS_OFFSET; + tmp = (tmp >> MRFLD_ISPSSPM0_ISPSSS_OFFSET) & MRFLD_ISPSSPM0_ISPSSC_MASK; if (tmp == val) { trace_ipu_cstate(enable); return 0; -- 2.27.0