Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp943365imm; Wed, 23 May 2018 07:54:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpcTvatAHlEstudBEYdXEjYuIeXTxESJ7baxnG5E+46ca30p1D5zlgaJSGT2XsL+FGyA/0U X-Received: by 2002:a63:6e88:: with SMTP id j130-v6mr2596681pgc.200.1527087290057; Wed, 23 May 2018 07:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527087290; cv=none; d=google.com; s=arc-20160816; b=E33IN2Di7lQsF9GYTZfUhtUy/TUWvD+P7haxTLr2J4vvVjNcAVj9KiSVD9vHAHzEH8 hLkBKxriC62ZkU9fKfrOTZLYgBPqYqXzx2F6vgHbW7T9J98aFj0PRTs20ipPhaddhloL GTWIk4rrM8WBzyfGz3DEdzNp0V4LSYRzG9KO13y62YCIoEJpwoLKcmcF/RBG9OT7YvUK lb/kLrHuVMrxtpQGc+nqkIGDLjmLJw52uY2skoiJ1aKw4pHd8kZBgDrkTZgkJVqFFlmZ nD30r4E8muTpLcZ+J0F/INfNT+fAVUMGlnyctXHSWH0xq5WHB7IuMpRC4/p2kzSwxeri N2xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=+j8Wi4pKw/s2L1yGaFT7SON+4h2JFrwIIBBAXP45Ctc=; b=R8Gs6FYOZg+76KrJ+zLvMe6mZGZu6o1Bs97z5WqshzOMw6PciKNjFoJ9BAb9JG+JpO ENuVDVF7+2pHij8R++Xf2IzHRhDhE44P038MUfYL0Wu3bPMmrNybUHZZ+d4RJnmGU5xD 0u24NcWNZJGcRB9QumBiZFvTfZZr9JHAvaxAHSFtriZSCkPiDZpQ5qg6DM7DXp9buGbW +ELTDrK401TXVjMH5Td2fPC1bzil3XA9VfuotOGbRJyUryFTFjo8A6fqxbGHwAGndPjN AjddBBrJYR3LlATA08dSPwIjK827dNXyciXhPE+UzAmvgFjPSnK7uY5JESrbaAIeWDzd lJfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s5YGjfHP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r76-v6si18445668pfb.65.2018.05.23.07.54.33; Wed, 23 May 2018 07:54:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s5YGjfHP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933340AbeEWOxT (ORCPT + 99 others); Wed, 23 May 2018 10:53:19 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:55803 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933132AbeEWOxR (ORCPT ); Wed, 23 May 2018 10:53:17 -0400 Received: by mail-wm0-f67.google.com with SMTP id a8-v6so9797899wmg.5 for ; Wed, 23 May 2018 07:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+j8Wi4pKw/s2L1yGaFT7SON+4h2JFrwIIBBAXP45Ctc=; b=s5YGjfHPQmnQEhWhNyNav5wsdfGtJuCyeQxnvKTbhlAQirVY8H/huBFQGDQWsJ6M1S b/aMOsihvF9j0M7yD6uBinSN8emBsqoRcUAX5wPLVpHUfQLDAS1thjEMedm7/KxsXpo0 4+dDfjftgxXMH3Px6xzC1rB2I/LJoyHV/i18fmRtmHqTqtKNvNDMO6ivj9rBaofsP4uT uCpz6KRbG/vHLxvheHEJQAOvjYVj2v2JsXGJ534DTeb7zMrD/JB+RZ16EXIUi8PvE6wi cRY1F4qtykAy9PNymspZxg4Yb52Nh4h0MNIwfeaJ/Y/nIdwbx/Dgh2GDz5Iw/UqK7pJa cNLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+j8Wi4pKw/s2L1yGaFT7SON+4h2JFrwIIBBAXP45Ctc=; b=r7mZxRmVvCGpQCZhIfCBTgxFkl1PFUhQtMyPZh3hiBy3NTdTZwts9/CxauArOddfwL xjGkz5eevpRwGEysTbuCiOWAIrYVL5htqmkIQHtYKfqOzQOjwmbY2UA/s1DXDJZsfv/2 AN7LTKbNDUPUidd8it9QZzOrN4JFQ0P/qI5OBrX0Jt6pT4ntv3TtxHmdiSf2idLxfYLf 10Jk11Ir/rAFh00IZdLD7hHrRCUGQ5ShszsKsHYR/O/nElB6yyS8NDQ75BVsQdXlXC2K NUmGHzy0FlhJWVwqjl6Z9UUdnkG0N1epyIiXfJiaZv5/kKx8JSc6ErBhYJz1NyR55dx+ jamg== X-Gm-Message-State: ALKqPweqM19kkLx87HMcEMsT6DngSh9fR6J7veduiw2zue09UScRprUl egD6gzWs9qXZdrs/r8Z/5i4= X-Received: by 2002:a2e:9b01:: with SMTP id u1-v6mr2079384lji.26.1527087196553; Wed, 23 May 2018 07:53:16 -0700 (PDT) Received: from localhost.localdomain ([94.25.228.210]) by smtp.gmail.com with ESMTPSA id b7-v6sm2451031lfa.31.2018.05.23.07.53.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 07:53:15 -0700 (PDT) From: Ivan Bornyakov To: linux-nvme@lists.infradead.org Cc: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me, linux-kernel@vger.kernel.org, Ivan Bornyakov Subject: [PATCH] nvme: host: core: fix precedence of ternary operator Date: Wed, 23 May 2018 17:56:11 +0300 Message-Id: <20180523145611.10297-1-brnkv.i1@gmail.com> X-Mailer: git-send-email 2.16.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ternary operator have lower precedence then bitwise or, so 'cdw10' was calculated wrong. Signed-off-by: Ivan Bornyakov --- drivers/nvme/host/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index b070c659391f..1eba9b0cb9dc 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1577,7 +1577,7 @@ static int nvme_pr_reserve(struct block_device *bdev, u64 key, static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, enum pr_type type, bool abort) { - u32 cdw10 = nvme_pr_type(type) << 8 | abort ? 2 : 1; + u32 cdw10 = nvme_pr_type(type) << 8 | (abort ? 2 : 1); return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); } @@ -1589,7 +1589,7 @@ static int nvme_pr_clear(struct block_device *bdev, u64 key) static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) { - u32 cdw10 = nvme_pr_type(type) << 8 | key ? 1 << 3 : 0; + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } -- 2.16.1