From patchwork Mon Nov 1 23:28:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 12597561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C6FC433EF for ; Mon, 1 Nov 2021 23:28:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E402E60EFF for ; Mon, 1 Nov 2021 23:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231136AbhKAXba (ORCPT ); Mon, 1 Nov 2021 19:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbhKAXb2 (ORCPT ); Mon, 1 Nov 2021 19:31:28 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0706CC061714 for ; Mon, 1 Nov 2021 16:28:55 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id h10-20020a63df4a000000b002a6ba425b58so5888828pgj.17 for ; Mon, 01 Nov 2021 16:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=21+ejev/noq+kYk89380VQS6wIIOK6ew/iH0Z8kMFjc=; b=Rv9g20+Fow2hNqn8xJNdw6YbM1c7l1W1DnK2zDR3mwBXZiKdBkvtuE3oUlnxcJBTUb UQD/OYEpgg99YstmSRIeo1cqLkZFPM9x7xvgruTIcOit+rY4n1oEevQ9nu0Y7W9LGhFR N7/kQlKCZirB/hhNpLibF8/inr1K3iFwEWkoyxsBJ7VU3n02FLCF04bZ0vqE5js5WNMh 9I4UpDBePYNkkX/PQBKVEuOIM/IWT3GCssdyz9JWi3GpIBTaHFZJmLY9390QjebDMPgf yqK2V3OQ4i8tbd0ScMfnzATh1/GVYFhk+nuwztvc0yF/fgDuKQLNuu9IfDNycSkEGhWV EA+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=21+ejev/noq+kYk89380VQS6wIIOK6ew/iH0Z8kMFjc=; b=olIkY3lwNhu0x0UJ1RHf8XLRyTeSGfJDSXFGngF6KKtQzD6qvl9ZqX2PXSflUrMwK0 5aGIHlDbEZe5oANyXyA18mZL+p9cUuolPzFppOAvb0bP+6waSSKrJsq5AvYIkYL0BY/l tETN08oZIK9yOpDF4p+fBqI5USqJdJg2QzTbeP49q6HPxyN+h+DDmWqCT2pXvYGs8TWF JdDws/IjGTJpeDvMJSYVg+THe8a3LUSPtZJk5jlQSVvsuxUdQXTKq8cJNmY+vtDjD3/1 jy09Lh6Np1dk3XQE87vzEDPQzjeqR1Up3S1gI6uaywznMDL7Nr+3FXk6KNk5OmoXLsvK xhMA== X-Gm-Message-State: AOAM5334fx/jtlZaFdAkCG1pbcqWtdojZ7NQq0LNYTt4rDb8mrOlSZea e44Ss+bqVfpLDgr5u68pqUneJoJpat5sOg== X-Google-Smtp-Source: ABdhPJxmzkgUQFwJrP54t7h0Sff/yh62kQ0SPT46cqgt3IEG4SWyQSTSdOw2NYlTMRFzULQ9fUTjFixL6z0mRg== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:11:3684:4dd2:e6b6:ef66]) (user=ipylypiv job=sendgmr) by 2002:a17:90b:1c05:: with SMTP id oc5mr2267896pjb.179.1635809334527; Mon, 01 Nov 2021 16:28:54 -0700 (PDT) Date: Mon, 1 Nov 2021 16:28:22 -0700 In-Reply-To: <20211101232825.2350233-1-ipylypiv@google.com> Message-Id: <20211101232825.2350233-2-ipylypiv@google.com> Mime-Version: 1.0 References: <20211101232825.2350233-1-ipylypiv@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp() From: Igor Pylypiv To: Jack Wang , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Vishakha Channapattan , Changyuan Lyu , linux-scsi@vger.kernel.org, Igor Pylypiv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Phy id is located in the least significant byte of the 4-byte field. mpi_phy_stop_resp() already applies such mask. Reviewed-by: Vishakha Channapattan Signed-off-by: Igor Pylypiv Acked-by: Jack Wang --- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 6ffe17b849ae..4f887925c9d2 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -3481,7 +3481,7 @@ static int mpi_phy_start_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) u32 status = le32_to_cpu(pPayload->status); u32 phy_id = - le32_to_cpu(pPayload->phyid); + le32_to_cpu(pPayload->phyid) & 0xFF; struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; pm8001_dbg(pm8001_ha, INIT, From patchwork Mon Nov 1 23:28:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 12597563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1068C433EF for ; Mon, 1 Nov 2021 23:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90D8060C40 for ; Mon, 1 Nov 2021 23:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbhKAXbb (ORCPT ); Mon, 1 Nov 2021 19:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbhKAXbb (ORCPT ); Mon, 1 Nov 2021 19:31:31 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92082C061714 for ; Mon, 1 Nov 2021 16:28:57 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id a84-20020a621a57000000b00480fcb384a7so3121407pfa.20 for ; Mon, 01 Nov 2021 16:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=2Xh/if2j5bKs14GrXeGI4p8CW0yILG7SJ9GF2+i+STs=; b=ZMDUFD7ea1ImDpI3iLIQoTbu2T0gCc67XYB9QpX00C1r7hiYuLg3KGlbJDGXYENSUq 0sYAVLlFkJENfXAQFjROtKZbN3RMEdvxPGqRQFUqeDV4zB57vP2mbapYkKHeJfQl+V3F OKTCgU7oaWqNi2/2Nrj7fE3bR64LX372+fx0BBV/75+iUhJkw0V0nwnV4GJrusw7dgou KSgbkKOkS9T4s0x1vXLIc6tohaea/SAMUj3IKrsmo2KSUqr5y+GLqPOnuFO0Ezj/UIJA kZp1nBvkcPWApblFeR/Bi0rSrg8PPR+zMu4vuk3MBBdrXt3YHdNsK6VW9Qfo2XXAXgxS VdzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=2Xh/if2j5bKs14GrXeGI4p8CW0yILG7SJ9GF2+i+STs=; b=LuGIpO/wuICHHjhn0QnyOtMsf/M+7Z9HOpjA6rrymZ1lt0aqqDlyT1Z9hpb8kyg0cU c755uufi0FJM3YyQYLhm0Oujvjt97TKyZvm68DRiidVkRbMEFjhJm0UEqSPdzzuEIk5y Du41y3K96/uTAv6vaLfWF5/N6Ek5/Vz5iFl2eONAocCZCsVesCwt42xwtxgO+2W+Bhwj y1NFotr1RbETOVbqNWw5rbxej0EV9jKdqSLBSemdcKJwmHK6lnIfMqTIvupRQ/bDZkk9 FUMpGbVK+eVa2dzC5xkmTva5KjoRQhFiKYC/g6iyYeNaWzgJbUV/fQf88F9QoutO4yMW BMPQ== X-Gm-Message-State: AOAM531MKt6glMsIajErK3EP46NwVqjuBFgicbwKdsvCC1oBOUF2BnEq zi0gImCVzstpaeqHoSzpHcL0yy9uIi0BOA== X-Google-Smtp-Source: ABdhPJxfOvCCi39pnxFC3U3uZ3wARZYxZNKNReBz5h0gZeTd5C59iOUeXb2FC/ycQqWN6Kki/1SBFLf0OoQ06A== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:11:3684:4dd2:e6b6:ef66]) (user=ipylypiv job=sendgmr) by 2002:a17:90b:4ad2:: with SMTP id mh18mr2280516pjb.18.1635809337132; Mon, 01 Nov 2021 16:28:57 -0700 (PDT) Date: Mon, 1 Nov 2021 16:28:23 -0700 In-Reply-To: <20211101232825.2350233-1-ipylypiv@google.com> Message-Id: <20211101232825.2350233-3-ipylypiv@google.com> Mime-Version: 1.0 References: <20211101232825.2350233-1-ipylypiv@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL From: Igor Pylypiv To: Jack Wang , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Vishakha Channapattan , Changyuan Lyu , linux-scsi@vger.kernel.org, Igor Pylypiv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Address-of operator cannot return NULL. Reviewed-by: Vishakha Channapattan Signed-off-by: Igor Pylypiv Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_hwi.c | 24 ++++-------------------- drivers/scsi/pm8001/pm80xx_hwi.c | 29 ++++++++--------------------- 2 files changed, 12 insertions(+), 41 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 63690508313b..1a593f2b2c87 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -2304,21 +2304,17 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) psataPayload = (struct sata_completion_resp *)(piomb + 4); status = le32_to_cpu(psataPayload->status); + param = le32_to_cpu(psataPayload->param); tag = le32_to_cpu(psataPayload->tag); if (!tag) { pm8001_dbg(pm8001_ha, FAIL, "tag null\n"); return; } + ccb = &pm8001_ha->ccb_info[tag]; - param = le32_to_cpu(psataPayload->param); - if (ccb) { - t = ccb->task; - pm8001_dev = ccb->device; - } else { - pm8001_dbg(pm8001_ha, FAIL, "ccb null\n"); - return; - } + t = ccb->task; + pm8001_dev = ccb->device; if (t) { if (t->dev && (t->dev->lldd_dev)) @@ -2335,10 +2331,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) } ts = &t->task_status; - if (!ts) { - pm8001_dbg(pm8001_ha, FAIL, "ts null\n"); - return; - } if (status) pm8001_dbg(pm8001_ha, IOERR, @@ -2695,14 +2687,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) u32 dev_id = le32_to_cpu(psataPayload->device_id); unsigned long flags; - ccb = &pm8001_ha->ccb_info[tag]; - - if (ccb) { - t = ccb->task; - pm8001_dev = ccb->device; - } else { - pm8001_dbg(pm8001_ha, FAIL, "No CCB !!!. returning\n"); - } if (event) pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event); diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 4f887925c9d2..f9e997b23d42 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -2399,21 +2399,17 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) psataPayload = (struct sata_completion_resp *)(piomb + 4); status = le32_to_cpu(psataPayload->status); + param = le32_to_cpu(psataPayload->param); tag = le32_to_cpu(psataPayload->tag); if (!tag) { pm8001_dbg(pm8001_ha, FAIL, "tag null\n"); return; } + ccb = &pm8001_ha->ccb_info[tag]; - param = le32_to_cpu(psataPayload->param); - if (ccb) { - t = ccb->task; - pm8001_dev = ccb->device; - } else { - pm8001_dbg(pm8001_ha, FAIL, "ccb null\n"); - return; - } + t = ccb->task; + pm8001_dev = ccb->device; if (t) { if (t->dev && (t->dev->lldd_dev)) @@ -2430,10 +2426,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) } ts = &t->task_status; - if (!ts) { - pm8001_dbg(pm8001_ha, FAIL, "ts null\n"); - return; - } if (status != IO_SUCCESS) { pm8001_dbg(pm8001_ha, FAIL, @@ -2804,15 +2796,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) u32 dev_id = le32_to_cpu(psataPayload->device_id); unsigned long flags; - ccb = &pm8001_ha->ccb_info[tag]; - - if (ccb) { - t = ccb->task; - pm8001_dev = ccb->device; - } else { - pm8001_dbg(pm8001_ha, FAIL, "No CCB !!!. returning\n"); - return; - } if (event) pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event); @@ -2826,6 +2809,10 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) return; } + ccb = &pm8001_ha->ccb_info[tag]; + t = ccb->task; + pm8001_dev = ccb->device; + if (unlikely(!t || !t->lldd_task || !t->dev)) { pm8001_dbg(pm8001_ha, FAIL, "task or dev null\n"); return; From patchwork Mon Nov 1 23:28:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 12597565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6000DC433F5 for ; Mon, 1 Nov 2021 23:29:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FC5C60F3A for ; Mon, 1 Nov 2021 23:29:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231312AbhKAXbe (ORCPT ); Mon, 1 Nov 2021 19:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbhKAXbd (ORCPT ); Mon, 1 Nov 2021 19:31:33 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D72C061714 for ; Mon, 1 Nov 2021 16:29:00 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id s39-20020a056a0017a700b00481146e614cso1937682pfg.9 for ; Mon, 01 Nov 2021 16:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=0AzsJhkimlVDnNzRhtFh4NkjiXk28BcHhpgCYuiZin0=; b=ozeXM+T7SJ4DUqmCdgy9l7pF9jMFQhafE3KZ2lthJCAKmH0UGsptWzxVkcp0Z9xaUK goQbEaPXVuTO9IVrQnKsSMJXP2DrVszIQGMwBrKX0JYkTZS/wYUm1EfyJ+uPcFUtC0pi zIzgosaM8X3qevG2llp8W3EBPWpXCFEQVWhqhdu72wlh0bsjd0nVfQJ3cbaDDrnqq5cy XiKTCTky0JuDUDPbbMJWbJgUNTHzRGxfHYkeRb2rwCgbuqf2KgFmbHsaeI8WxT3F4HGe z9WJovvE3+GZ6DQeD6qVgCGbCpHF7WDuxFVcyN6pfMp43Ac6ToZp2Bm/H+1JYIvTQBOF Cdlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0AzsJhkimlVDnNzRhtFh4NkjiXk28BcHhpgCYuiZin0=; b=TPQ6cuOxgAvnk0mE1GS+TpTX3+iaMADZXUuoSC6lhLnXNhyf8kkW5eSvkYW1rd8any tCYiJIllvTo2D2iypG6xo+mbR+ZvXvFIPmS1RXMB+zrEHDxviGjHU6cw2o/2E6gCT8AE 4oboOdUW8YRSD4wXPX8sbEnvVIzFnhZIxnfMk+dyR4rw8vOAJs4oIvtx9v6ox0fSrRQr 1gDJECReKPWZ8XBnDXNgjK77UtoBOo9r+bCOEzCW1N1Z7eC6UTL0txl78OqZ+8kgMBhP IgZb42VM5eFUnj1y2aW9c4SWfSeeWvLZdvmknNeD5p/UahWXzUAX3r5T36OMqkjPlx0A O0eQ== X-Gm-Message-State: AOAM532tn/mbAjaOkbxWd5aO58+6HRFZe8kDOUQp8xtRBavC78Y4jg42 /UqgfI+RMV8FWo01RsovQCTSJeqUQL8lBA== X-Google-Smtp-Source: ABdhPJx5wSSNdtJdIO6p/I3bSO1QkKyuJik+9A9q/4/1BKvIeW18UQSFYeza9tUX4tlRky4kR6bbAziY9iiUpQ== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:11:3684:4dd2:e6b6:ef66]) (user=ipylypiv job=sendgmr) by 2002:a17:902:b697:b0:141:c7aa:e10f with SMTP id c23-20020a170902b69700b00141c7aae10fmr15248873pls.18.1635809339684; Mon, 01 Nov 2021 16:28:59 -0700 (PDT) Date: Mon, 1 Nov 2021 16:28:24 -0700 In-Reply-To: <20211101232825.2350233-1-ipylypiv@google.com> Message-Id: <20211101232825.2350233-4-ipylypiv@google.com> Mime-Version: 1.0 References: <20211101232825.2350233-1-ipylypiv@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() From: Igor Pylypiv To: Jack Wang , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Vishakha Channapattan , Changyuan Lyu , linux-scsi@vger.kernel.org, Igor Pylypiv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Starting from commit 05c6c029a44d9 ("scsi: pm80xx: Increase number of supported queues") driver initializes only max_q_num queues. Do not use an invalid queue if the WARN_ON condition is true. Fixes: 7640e1eb8c5de ("scsi: pm80xx: Make mpi_build_cmd locking consistent") Reviewed-by: Vishakha Channapattan Signed-off-by: Igor Pylypiv Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_hwi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 1a593f2b2c87..3d41f0ac6595 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -1325,7 +1325,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, int q_index = circularQ - pm8001_ha->inbnd_q_tbl; int rv; - WARN_ON(q_index >= PM8001_MAX_INB_NUM); + if (WARN_ON(q_index >= pm8001_ha->max_q_num)) + return -EINVAL; + spin_lock_irqsave(&circularQ->iq_lock, flags); rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, &pMessage); From patchwork Mon Nov 1 23:28:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Pylypiv X-Patchwork-Id: 12597567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B610C433F5 for ; Mon, 1 Nov 2021 23:29:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E80F860EE5 for ; Mon, 1 Nov 2021 23:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231405AbhKAXbj (ORCPT ); Mon, 1 Nov 2021 19:31:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbhKAXbi (ORCPT ); Mon, 1 Nov 2021 19:31:38 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC6FCC061714 for ; Mon, 1 Nov 2021 16:29:04 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id y125-20020a25dc83000000b005c2326bf744so9158175ybe.21 for ; Mon, 01 Nov 2021 16:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Sph44qoedFxIBxzHBFHZscYWNo2pFD2fSGj7R4UIzT0=; b=g+ZdiZ3qPkBdI92UTCk1wchRVYwSwgqHl0uPpjhAXRAVudH4vUIp1aDES4gK0PA7zM FAJ0kjrC0LMmZTcvqONSkcuG30GPdCzneoOKkthz22+3bU5DVinN4ZZ3fwxfaFdcQktD fSCYcNuHT9/yK3G+1mvBM/5d6CIFIg17njJPH2YLN+1z/2Lqf4lTORAjLDYQP2qKVVAF cGspxZL6tVBCRhj2bDGfjB1d5M2WV1xNLSq7kEVkmqNLLNkeBLq2936TsvDKNn7EwnyU INSP6za9bP3YjteEgan2TLnHsubvftv/KSMpZ9p98rJwj30z5Z54lEMA/4oSXZLGnxen KVUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Sph44qoedFxIBxzHBFHZscYWNo2pFD2fSGj7R4UIzT0=; b=v226KPi1JMlxPKbRUzyw31L2oGdRTesKRhbq9UEpOg7oSzvwKmDFoMQ0yHqQO2d9VT DgcfsvcVndXWzXlLVi/Sqfpuh9d0RbBbFGhv8qX5414/ByNnbXWIRkMArLGSa8xxL2/z MLXNITQK4kJcjmayjfeaQ+h6zmhD2Bw6+ke+na4/2ddgiQoHh8FY570LxB532zp9zNgU AM6ntn8cf7F326ltDlaJGMskGj5e+x6r5ItpLh1/CN8AV2Ofv2gj+iBwina58vC3SNmG Bc++OkE6SRs+bZzAdWzsK6QHb/Y5hKVDX2SSnZTOtHQFOMUh8nq6KNcojO5y+tU+D43k qtgg== X-Gm-Message-State: AOAM531nXOwzXyV4v+MvDG0ofbUOlBGkQ0P2xJaNbOvsJEcBNr23PznO w3BniRTqBwCJkJWCOqpkV0SdYGNct+/PuQ== X-Google-Smtp-Source: ABdhPJw8vJA4UOq7Y3ucFhZM6bqoxrEwkT6g/1r8Zz6DyOv2wKQgzpT4DQyKKLQNWb9PH6eFDeCkmZxOSwP1OQ== X-Received: from ipylypiv.svl.corp.google.com ([2620:15c:2c5:11:3684:4dd2:e6b6:ef66]) (user=ipylypiv job=sendgmr) by 2002:a25:744d:: with SMTP id p74mr31897561ybc.445.1635809344022; Mon, 01 Nov 2021 16:29:04 -0700 (PDT) Date: Mon, 1 Nov 2021 16:28:25 -0700 In-Reply-To: <20211101232825.2350233-1-ipylypiv@google.com> Message-Id: <20211101232825.2350233-5-ipylypiv@google.com> Mime-Version: 1.0 References: <20211101232825.2350233-1-ipylypiv@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation From: Igor Pylypiv To: Jack Wang , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Vishakha Channapattan , Changyuan Lyu , linux-scsi@vger.kernel.org, Igor Pylypiv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We used to allocate X bytes while we only need X bits. Reviewed-by: Vishakha Channapattan Signed-off-by: Igor Pylypiv Acked-by: Jack Wang --- drivers/scsi/pm8001/pm8001_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 47db7e0beae6..9935cf20b93d 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -178,7 +178,7 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha) } PM8001_CHIP_DISP->chip_iounmap(pm8001_ha); flush_workqueue(pm8001_wq); - kfree(pm8001_ha->tags); + bitmap_free(pm8001_ha->tags); kfree(pm8001_ha); } @@ -1193,7 +1193,7 @@ pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost, can_queue = ccb_count - PM8001_RESERVE_SLOT; shost->can_queue = can_queue; - pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL); + pm8001_ha->tags = bitmap_zalloc(ccb_count, GFP_KERNEL); if (!pm8001_ha->tags) goto err_out;