public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Pekka Enberg <penberg@kernel.org>
Cc: kvm@vger.kernel.org, Sasha Levin <levinsasha928@gmail.com>
Subject: Re: [PATCH] kvm tools, i8042: Fix device init failure
Date: Thu, 2 Jun 2011 15:40:37 +0200	[thread overview]
Message-ID: <20110602134037.GA26199@elte.hu> (raw)
In-Reply-To: <1307021895-20434-1-git-send-email-penberg@kernel.org>


* Pekka Enberg <penberg@kernel.org> wrote:

>  static bool kbd_in(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size, u32 count)
>  {
> -	u32 result;
> -
> -	if (port == I8042_COMMAND_REG) {
> -		result = kbd_read_status();
> -		ioport__write8(data, (char)result);
> -	} else {
> -		result = kbd_read_data();
> -		ioport__write32(data, result);
> +	switch (port) {
> +	case I8042_COMMAND_REG: {
> +		u8 value = kbd_read_status();
> +		ioport__write8(data, value);
> +		break;
> +	}
> +	case I8042_DATA_REG: {
> +		u32 value = kbd_read_data();
> +		ioport__write32(data, value);
> +		break;
>  	}
> +	default:
> +		break;

should we BUG_ON() [or WARN_ON()] in that 'default' case?

> +	default:
> +		break;

ditto. This could have caught the bug straight away, right?

Thanks,

	Ingo

  reply	other threads:[~2011-06-02 13:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 13:38 [PATCH] kvm tools, i8042: Fix device init failure Pekka Enberg
2011-06-02 13:40 ` Ingo Molnar [this message]
2011-06-02 13:49   ` Pekka Enberg
2011-06-02 13:45 ` Sasha Levin

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=20110602134037.GA26199@elte.hu \
    --to=mingo@elte.hu \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=penberg@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