On Fri, Feb 10, 2012 at 12:53 PM, Sasha Levin <[email protected]> wrote:
> On Fri, 2012-02-10 at 10:34 +0800, Yang Bai wrote:
>> On Thu, Feb 9, 2012 at 9:07 PM, Cyrill Gorcunov <[email protected]> wrote:
>> > On Thu, Feb 09, 2012 at 03:01:26PM +0200, Pekka Enberg wrote:
>> >> On Thu, Feb 9, 2012 at 7:40 AM, Yang Bai <[email protected]> wrote:
>> >> > Since the different issues have been handled in the
>> >> > internal of kvm__init, it can only return NULL if error
>> >> > happened.
>> >> >
>> >> > Signed-off-by: Yang Bai <[email protected]>
>> >>
>> >> Sorry, I don't understand what this patch is attempting to fix? Why do
>> >> you think it's better to drop the explicit error codes and always
>> >> return NULL upon error?
>> >>
>>
>> Ok. Since the different issues have been handled in the internal of
>> this function and the caller does not care about the real error
>> reasons. So just return NULL if error will simplify the error handle
>> of the caller.
>
> Um... why doesn't the caller care about the real error? It's whats being
> sent back to userspace and can help the caller determine whats going on.
>
Reading the source code, I found that the caller handle it as following:
static int kvm_cmd_run_init(int argc, const char **argv)
{
[snip]
kvm = kvm__init(dev, hugetlbfs_path, ram_size, guest_name);
if (IS_ERR(kvm)) {
r = PTR_ERR(kvm);
goto fail;
}
[snip]
fail:
return r;
}
int kvm_cmd_run(int argc, const char **argv, const char *prefix)
{
[snip]
r = kvm_cmd_run_init(argc, argv);
if (r < 0)
return r;
[snip]
}
So the real reason is ignored.
> --
>
> Sasha.
>
--
"""
Keep It Simple,Stupid.
"""
Chinese Name: 白杨
Nick Name: Hamo
Homepage: http://hamobai.com/
GPG KEY ID: 0xA4691A33
Key fingerprint = 09D5 2D78 8E2B 0995 CF8E 4331 33C4 3D24 A469 1A33
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html