From patchwork Sun Jan 8 19:13:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 40549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1820673wrt; Sun, 8 Jan 2023 11:14:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXWsGWX8b/92ApIBFiV94HykD/AkkiMuaObYy+2inbox/y5T1xPTMla/zuLhYc/RPoLxiW X-Received: by 2002:a62:e911:0:b0:581:579d:5c44 with SMTP id j17-20020a62e911000000b00581579d5c44mr42611572pfh.5.1673205266978; Sun, 08 Jan 2023 11:14:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673205266; cv=none; d=google.com; s=arc-20160816; b=b1YvQ/CrxlON5deOPhwllerb5ThqNi//IiLsNeWREqP4icO9wrgvIm/7o13gB+B0rC 9j5atd3ihBnujI+PjJCoKWMGTvdPH4fvlRrZQWgy9Wk922MJ09p7MrCBQj5bSbL6ELWj va0LFFqfBLtv1zD09E/rNTdWqT5bGn4e3jnCc/Ks5+wAi2OIgfSqB9ltaLuaO5yAJnXv yOfoMkvQtDxrlK27R/N9m/juPrGjTFZEBFZJ3SqIpQxI2VzOBBMTpLZ+8a26yX6EFf7s wi56nL/TAAyTY5q4cKqPOU7MUyFnuhIpnjy8LV4ueUKCVvvOJsMlZXhrhHTmL91YvcNM kazg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=W4LexCO8gErhrVbp7woZLWFqkqrbzZ0GiBaB2I6MGxY=; b=fqkxtSPA6WdjT4muXrc0GDcUWOWXMf8qHMetP/Df2xjwICsiUNKBai1rJ9ETWXVJe1 sNQ82/p/ljujGSTS/UGV+X+HYz6Tyv6wnGDIv8PMkOvknI+D3e/DAM9L1KjAjEB+cPqE bPBHkWY7Ia+zwFuCVVMWKCVGhooqvzjsvnwP+YQYHQcZHxzra/pwSEhlrHkSBlgAFJDf J5Gah1EZBCVtjImLS5UAnLu/9fE6mpln+hnUPYK5et9Xo3YsDrAXGUcCc+02T4pE8tX7 8jG38qTfvTJAjWh1juNkMczspNglHtPzdUmHLVFdSV/jcSMT1GY9Lck0R/pqnrMujXwy SWLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=mTWVk3o4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z24-20020a056a001d9800b005879278c7fesi2937790pfw.317.2023.01.08.11.14.13; Sun, 08 Jan 2023 11:14:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=mTWVk3o4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbjAHTOM (ORCPT + 99 others); Sun, 8 Jan 2023 14:14:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233104AbjAHTOK (ORCPT ); Sun, 8 Jan 2023 14:14:10 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9541964D1; Sun, 8 Jan 2023 11:14:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673205241; bh=3IgVzGcbKlvB9iXK55wFWtWMolgT1lNBS+PC0hqxscw=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=mTWVk3o4hQ4l049eOGat8J9TwAcHF+OEF2WPdZG2gmlSSFeA6hOfJVb4VWyimbCYK YbPjal41i6J5nB8p82eJJcxEmJEgb9U0T+GLeXiIEMykkE0PGx/Xij8lMUJPV0s/l+ T8MxhDisbghNhyYQ4fV7Dfc8++TYU1Y0b25Y2jag= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 8 Jan 2023 20:14:01 +0100 (CET) X-EA-Auth: CYo250FgwwXLDinjEhWIxunfu44PrNgg365QQUi/nkLXQDHLIAwfIj1J7A/8XMObPNptZNvzbbsysxgpl5lJTs5HVeZ3w5V9 Date: Mon, 9 Jan 2023 00:43:56 +0530 From: Deepak R Varma To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH] scsi: Replace printk+WARN_ON by WARN macro Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754482886434193402?= X-GMAIL-MSGID: =?utf-8?q?1754482886434193402?= A combination of printk() followed by WARN_ON() macro can be simplified using a single WARN(1, ...) macro. Patch change suggested by warn.cocci Coccinelle semantic patch. Signed-off-by: Deepak R Varma --- drivers/scsi/initio.c | 3 +-- drivers/scsi/scsi_lib.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 375261d67619..fea591d9d292 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -2738,8 +2738,7 @@ static void i91uSCBPost(u8 * host_mem, u8 * cblk_mem) host = (struct initio_host *) host_mem; cblk = (struct scsi_ctrl_blk *) cblk_mem; if ((cmnd = cblk->srb) == NULL) { - printk(KERN_ERR "i91uSCBPost: SRB pointer is empty\n"); - WARN_ON(1); + WARN(1, KERN_ERR "i91uSCBPost: SRB pointer is empty\n"); initio_release_scb(host, cblk); /* Release SCB for current channel */ return; } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9ed1ebcb7443..96c9a561973e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -3009,10 +3009,8 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count, } if (unlikely(i == sg_count)) { - printk(KERN_ERR "%s: Bytes in sg: %zu, requested offset %zu, " - "elements %d\n", - __func__, sg_len, *offset, sg_count); - WARN_ON(1); + WARN(1, printk(KERN_ERR "%s: Bytes in sg: %zu, requested offset %zu, elements %d\n", + __func__, sg_len, *offset, sg_count); return NULL; }