From patchwork Fri Sep 14 10:48:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10600613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 080C014BD for ; Fri, 14 Sep 2018 10:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1C8D2B253 for ; Fri, 14 Sep 2018 10:50:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C61862B256; Fri, 14 Sep 2018 10:50:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E30932B253 for ; Fri, 14 Sep 2018 10:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727972AbeINQEX (ORCPT ); Fri, 14 Sep 2018 12:04:23 -0400 Received: from www.osadl.org ([62.245.132.105]:57482 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbeINQEX (ORCPT ); Fri, 14 Sep 2018 12:04:23 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w8EAoApa032592; Fri, 14 Sep 2018 12:50:10 +0200 From: Nicholas Mc Guire To: "James E.J. Bottomley" Cc: "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] scsi: core: drop excess unlikely() from BUG_ON() Date: Fri, 14 Sep 2018 12:48:27 +0200 Message-Id: <1536922107-2649-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP include/asm-generic/bug.h defines BUG_ON(condition) as do { if (unlikely(condition)) BUG(); } while (0). So BUG_ON already provides unlikely() to the condition so there is no point in having a unlikely(unlikely(condition)) - drop the excess unlikely() Signed-off-by: Nicholas Mc Guire --- Found during code review Patch was compile tested with: x86_64_defconfig (implies CONFIG_SCSI) SCSI_LOWLEVE=y, SCSI_HISI_SAS=y, COMPILE_TEST=y (with some unrelated sparse warnings and some pending coccinelle findings) Patch is against 4.19-rc3 (localversion-next is next-20180913) drivers/scsi/scsi_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index eb97d2d..0b4132f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1201,8 +1201,8 @@ int scsi_init_io(struct scsi_cmnd *cmd) count = blk_rq_map_integrity_sg(rq->q, rq->bio, prot_sdb->table.sgl); - BUG_ON(unlikely(count > ivecs)); - BUG_ON(unlikely(count > queue_max_integrity_segments(rq->q))); + BUG_ON(count > ivecs); + BUG_ON(count > queue_max_integrity_segments(rq->q)); cmd->prot_sdb = prot_sdb; cmd->prot_sdb->table.nents = count;