From: Himanshu Madhani <himanshu.madhani@oracle.com>
To: Yang Li <abaci-bugfix@linux.alibaba.com>
Cc: "martin.petersen@oracle.c" <martin.petersen@oracle.c>,
Martin Petersen <martin.petersen@oracle.com>,
"njavali@marvell.com" <njavali@marvell.com>,
"GR-QLogic-Storage-Upstream@marvell.com"
<GR-QLogic-Storage-Upstream@marvell.com>,
"mrangankar@marvell.com" <mrangankar@marvell.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] scsi: qla2xxx: remove redundant NULL check
Date: Fri, 22 Jan 2021 18:37:04 +0000 [thread overview]
Message-ID: <984381A1-692A-42DB-818B-0A0ACAF57D10@oracle.com> (raw)
In-Reply-To: <1611306174-92627-1-git-send-email-abaci-bugfix@linux.alibaba.com>
> On Jan 22, 2021, at 3:02 AM, Yang Li <abaci-bugfix@linux.alibaba.com> wrote:
>
> Fix below warnings reported by coccicheck:
> ./drivers/scsi/qla2xxx/qla_init.c:3371:2-7: WARNING: NULL check before
> some freeing functions is not needed.
> ./drivers/scsi/qla2xxx/qla_init.c:7855:5-10: WARNING: NULL check before
> some freeing functions is not needed.
> ./drivers/scsi/qla2xxx/qla_init.c:7916:2-7: WARNING: NULL check before
> some freeing functions is not needed.
> ./drivers/scsi/qla2xxx/qla_init.c:8113:4-18: WARNING: NULL check before
> some freeing functions is not needed.
> ./drivers/scsi/qla2xxx/qla_init.c:8174:2-7: WARNING: NULL check before
> some freeing functions is not needed.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
> ---
> drivers/scsi/qla2xxx/qla_init.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index dcc0f0d8..edd5dd1 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -3371,8 +3371,7 @@ static void qla2x00_tmf_sp_done(srb_t *sp, int res)
> "Re-Allocated (%d KB) and save firmware dump.\n",
> dump_size / 1024);
> } else {
> - if (ha->fw_dump)
> - vfree(ha->fw_dump);
> + vfree(ha->fw_dump);
> ha->fw_dump = fw_dump;
>
> ha->fw_dump_len = ha->fw_dump_alloc_len =
> @@ -7855,8 +7854,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword)
> templates = (risc_attr & BIT_9) ? 2 : 1;
> ql_dbg(ql_dbg_init, vha, 0x0160, "-> templates = %u\n", templates);
> for (j = 0; j < templates; j++, fwdt++) {
> - if (fwdt->template)
> - vfree(fwdt->template);
> + vfree(fwdt->template);
> fwdt->template = NULL;
> fwdt->length = 0;
>
> @@ -7916,8 +7914,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword)
> return QLA_SUCCESS;
>
> failed:
> - if (fwdt->template)
> - vfree(fwdt->template);
> + vfree(fwdt->template);
> fwdt->template = NULL;
> fwdt->length = 0;
>
> @@ -8113,8 +8110,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword)
> templates = (risc_attr & BIT_9) ? 2 : 1;
> ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates);
> for (j = 0; j < templates; j++, fwdt++) {
> - if (fwdt->template)
> - vfree(fwdt->template);
> + vfree(fwdt->template);
> fwdt->template = NULL;
> fwdt->length = 0;
>
> @@ -8174,8 +8170,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword)
> return QLA_SUCCESS;
>
> failed:
> - if (fwdt->template)
> - vfree(fwdt->template);
> + vfree(fwdt->template);
> fwdt->template = NULL;
> fwdt->length = 0;
>
> --
> 1.8.3.1
>
Make Sense.
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani Oracle Linux Engineering
next prev parent reply other threads:[~2021-01-22 19:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 9:02 Yang Li
2021-01-22 9:02 ` [PATCH 2/2] scsi: qla4xxx: " Yang Li
2021-01-22 18:37 ` Himanshu Madhani [this message]
2021-01-27 4:54 ` [PATCH 1/2] scsi: qla2xxx: " Martin K. Petersen
2021-01-22 9:16 Yang Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=984381A1-692A-42DB-818B-0A0ACAF57D10@oracle.com \
--to=himanshu.madhani@oracle.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=abaci-bugfix@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.c \
--cc=martin.petersen@oracle.com \
--cc=mrangankar@marvell.com \
--cc=njavali@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®