mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jakob Koschel <jakobkoschel@gmail.com>
To: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
	Alim Akhtar <alim.akhtar@samsung.com>,
	avri.altman@wdc.com, daejun7.park@samsung.com,
	bvanassche@acm.org, beanhuo@micron.com, keosung.park@samsung.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ufs: remove an unneed NULL check on list iterator
Date: Sun, 20 Mar 2022 01:57:39 +0100	[thread overview]
Message-ID: <6EEE0ACC-6F7F-4D29-AA2B-751E4677B35E@gmail.com> (raw)
In-Reply-To: <20220319042657.21835-1-xiam0nd.tong@gmail.com>


> On 19. Mar 2022, at 05:26, Xiaomeng Tong <xiam0nd.tong@gmail.com> wrote:
> 
> The list iterator is always non-NULL so it doesn't need to be checked.
> Thus just remove the unnecessary NULL check.
> 
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
> ---
> drivers/scsi/ufs/ufshpb.c | 6 ------
> 1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
> index 2d36a0715..a3db0ad60 100644
> --- a/drivers/scsi/ufs/ufshpb.c
> +++ b/drivers/scsi/ufs/ufshpb.c
> @@ -869,12 +869,6 @@ static struct ufshpb_region *ufshpb_victim_lru_info(struct ufshpb_lu *hpb)
> 	struct ufshpb_region *rgn, *victim_rgn = NULL;
> 
> 	list_for_each_entry(rgn, &lru_info->lh_lru_rgn, list_lru_rgn) {
> -		if (!rgn) {
> -			dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> -				"%s: no region allocated\n",
> -				__func__);
> -			return NULL;
> -		}

Maybe it make more sense to move that check after the loop body instead
of removing it completely? This code obviously does nothing in it's current
state but it's clear what the original intention was, so restoring that would
perhaps be better.

But probably someone with more experience about this code can make the call

> 		if (ufshpb_check_srgns_issue_state(hpb, rgn))
> 			continue;
> 
> -- 
> 2.17.1
> 

	Jakob


  reply	other threads:[~2022-03-20  0:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19  4:26 Xiaomeng Tong
2022-03-20  0:57 ` Jakob Koschel [this message]
2022-03-20  4:57   ` Xiaomeng Tong

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=6EEE0ACC-6F7F-4D29-AA2B-751E4677B35E@gmail.com \
    --to=jakobkoschel@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=daejun7.park@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=keosung.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=xiam0nd.tong@gmail.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®