Re: [PATCH] scsi: lpfc: remove unnnecessary NULL check

Paul Ely <[email protected]>
Newsgroups gmane.linux.scsi,gmane.linux.kernel,gmane.linux.kernel.janitors
Message-ID <CAEQnVQmH-5hKN-LduEFkPNz92cndybWj9CFM=fC0mOzwovpgsQ@mail.gmail.com>
On Thu, Aug 13, 2026 at 3:09 AM Dan Carpenter <[email protected]> wrote:
>
> The "evt_dat" variale is non-NULL at this point so there is no need to
> check.  Delete the check and pull the code in a tab.
>
> Signed-off-by: Dan Carpenter <[email protected]>
> ---
>  drivers/scsi/lpfc/lpfc_bsg.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
> index c95165905483..7354ae9ba8e5 100644
> --- a/drivers/scsi/lpfc/lpfc_bsg.c
> +++ b/drivers/scsi/lpfc/lpfc_bsg.c
> @@ -1329,10 +1329,8 @@ lpfc_bsg_hba_get_event(struct bsg_job *job)
>         else
>                 bsg_reply->reply_payload_rcv_len = 0;
>
> -       if (evt_dat) {
> -               kfree(evt_dat->data);
> -               kfree(evt_dat);
> -       }
> +       kfree(evt_dat->data);
> +       kfree(evt_dat);
>
>         spin_lock_irqsave(&phba->ct_ev_lock, flags);
>         lpfc_bsg_event_unref(evt);
> --
> 2.53.0
>

Yes, evt_data was already checked for NULL and the follow up check has no value.
Looks good.

Reviewed-by: Paul Ely <[email protected]>
smime.p7s (application/pkcs7-signature, 5.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.