Fix to return -ENOMEM from the error handling case instead of
0 (overwrited to 0 by the HYPERVISOR_event_channel_op call),
otherwise the error condition cann't be reflected from the
return value.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
{
unsigned port = info->evtchn;
unsigned new_array_pages;
- int ret = -ENOMEM;
+ int ret;
new_array_pages = port / EVENT_WORDS_PER_PAGE + 1;
array_page = event_array[event_array_pages];
if (!array_page) {
array_page = (void *)__get_free_page(GFP_KERNEL);
- if (array_page == NULL)
+ if (array_page == NULL) {
+ ret = -ENOMEM;
goto error;
+ }
event_array[event_array_pages] = array_page;
}