Subject: Re: [PATCH v6 1/4] KVM: PPC: epapr: Factor out the epapr init

From: Scott Wood <[email-masked]>
Date: Mon, 27 Feb 2012 14:52:25 -0600

On 02/23/2012 03:22 AM, Liu Yu wrote:
> +static int __init epapr_paravirt_init(void)
> +{
> +	struct device_node *hyper_node;
> +	const u32 *insts;
> +	int len, i;
> +
> +	hyper_node = of_find_node_by_path("/hypervisor");
> +	if (!hyper_node)
> +		return -ENODEV;
> +
> +	insts = of_get_property(hyper_node, "hcall-instructions", &len);
> +	if (!insts)
> +		return 0;

-ENODEV here too.

> +	if (!(len % 4) && len <= (4 * 4)) {
> +		for (i = 0; i < (len / 4); i++)
> +			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +
> +		epapr_paravirt_enabled = true;
> +	} else {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt: hcall-instructions format error\n");
> +	}

Do this:

if (error) {
	print error
	return error code
}

continue with function

Not this:

if (!error) {
	continue with function
} else {
	report the error from several lines back
}

> @@ -33,6 +34,14 @@ config KVM_GUEST
>  
>  	  In case of doubt, say Y
>  
> +config EPAPR_PARAVIRT
> +	bool "ePAPR para-virtualization support"
> +	default n
> +	help
> +	  Used to enalbe ePAPR complied para-virtualization support for guest.
> +
> +	  In case of doubt, say Y

s/Used to enalbe/Enable/

s/complied/compliant/ (or just s/complied//)

-Scott