linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Qian Cai <cai@lca.pw>, akpm@linux-foundation.org
Cc: gregkh@linuxfoundation.org, rafael@kernel.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] drivers/base/memory: fix a compilation warning
Date: Fri, 31 May 2019 19:33:32 +0200	[thread overview]
Message-ID: <b88a55b2-b101-b266-24df-377bb49d93e1@redhat.com> (raw)
In-Reply-To: <1559320186-28337-1-git-send-email-cai@lca.pw>

On 31.05.19 18:29, Qian Cai wrote:
> The linux-next commit 8553938ba3bd ("drivers/base/memory: pass a
> block_id to init_memory_block()") left an unused variable,
> 
> drivers/base/memory.c: In function 'add_memory_block':
> drivers/base/memory.c:697:33: warning: variable 'section_nr' set but not
> used [-Wunused-but-set-variable]
> 
> Also, rework the code logic a bit.
> 
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>  drivers/base/memory.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index f28efb0bf5c7..826dd76f662e 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -694,17 +694,13 @@ static int init_memory_block(struct memory_block **memory, int block_id,
>  static int add_memory_block(int base_section_nr)
>  {
>  	struct memory_block *mem;
> -	int i, ret, section_count = 0, section_nr;
> +	int i, ret, section_count = 0;
>  
>  	for (i = base_section_nr;
>  	     i < base_section_nr + sections_per_block;
> -	     i++) {
> -		if (!present_section_nr(i))
> -			continue;
> -		if (section_count == 0)
> -			section_nr = i;
> -		section_count++;
> -	}
> +	     i++)
> +		if (present_section_nr(i))
> +			section_count++;
>  
>  	if (section_count == 0)
>  		return 0;
> 

Thanks!

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb


      reply	other threads:[~2019-05-31 17:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 16:29 [PATCH -next] drivers/base/memory: fix a compilation warning Qian Cai
2019-05-31 17:33 ` David Hildenbrand [this message]

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=b88a55b2-b101-b266-24df-377bb49d93e1@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rafael@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).