public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: wzt.wzt@gmail.com
Cc: linux-kernel@vger.kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init()
Date: Mon, 12 Apr 2010 19:09:50 +0300	[thread overview]
Message-ID: <4BC345CE.9070501@redhat.com> (raw)
In-Reply-To: <20100412093452.GB2707@localhost.localdomain>

On 04/12/2010 12:34 PM, wzt.wzt@gmail.com wrote:
> ret is already set as ENOMEM before, so the second ret = -ENOMEM; can be removed.
>
>
> diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
> index 5169736..c0dcfb7 100644
> --- a/virt/kvm/coalesced_mmio.c
> +++ b/virt/kvm/coalesced_mmio.c
> @@ -101,7 +101,6 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
>   		goto out_err;
>   	kvm->coalesced_mmio_ring = page_address(page);
>
> -	ret = -ENOMEM;
>   	dev = kzalloc(sizeof(struct kvm_coalesced_mmio_dev), GFP_KERNEL);
>   	if (!dev)
>   		goto out_free_page;
>    

I prefer to keep it there and let the compiler do the elimination.  
Otherwise inserting any code in the middle may cause a bug (the 
assignment is logically part of the code block, it only matches the 
previous one by accident).

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


      reply	other threads:[~2010-04-12 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12  9:34 [PATCH] KVM: remove unused code in kvm_coalesced_mmio_init() wzt.wzt
2010-04-12 16:09 ` Avi Kivity [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=4BC345CE.9070501@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=wzt.wzt@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