Re: [PATCH] kvm tools, i8042: Fix device init failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Pekka Enberg <penberg@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux