2020-09-19 07:15:56

by Jing Xiangfeng

[permalink] [raw]
Subject: [PATCH] KVM: PPC: Book3S: Remove redundant initialization of variable ret

The variable ret is being initialized with '-ENOMEM' that is meaningless.
So remove it.

Signed-off-by: Jing Xiangfeng <[email protected]>
---
arch/powerpc/kvm/book3s_64_vio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index 1a529df0ab44..b277a75cd1be 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -283,7 +283,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
struct kvmppc_spapr_tce_table *siter;
struct mm_struct *mm = kvm->mm;
unsigned long npages, size = args->size;
- int ret = -ENOMEM;
+ int ret;

if (!args->size || args->page_shift < 12 || args->page_shift > 34 ||
(args->offset + args->size > (ULLONG_MAX >> args->page_shift)))
--
2.17.1


2020-09-21 13:47:16

by Fabiano Rosas

[permalink] [raw]
Subject: Re: [PATCH] KVM: PPC: Book3S: Remove redundant initialization of variable ret

Jing Xiangfeng <[email protected]> writes:

> The variable ret is being initialized with '-ENOMEM' that is meaningless.
> So remove it.
>
> Signed-off-by: Jing Xiangfeng <[email protected]>

Reviewed-by: Fabiano Rosas <[email protected]>

> ---
> arch/powerpc/kvm/book3s_64_vio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
> index 1a529df0ab44..b277a75cd1be 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -283,7 +283,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
> struct kvmppc_spapr_tce_table *siter;
> struct mm_struct *mm = kvm->mm;
> unsigned long npages, size = args->size;
> - int ret = -ENOMEM;
> + int ret;
>
> if (!args->size || args->page_shift < 12 || args->page_shift > 34 ||
> (args->offset + args->size > (ULLONG_MAX >> args->page_shift)))

2020-09-23 01:25:31

by Paul Mackerras

[permalink] [raw]
Subject: Re: [PATCH] KVM: PPC: Book3S: Remove redundant initialization of variable ret

On Sat, Sep 19, 2020 at 03:12:30PM +0800, Jing Xiangfeng wrote:
> The variable ret is being initialized with '-ENOMEM' that is meaningless.
> So remove it.
>
> Signed-off-by: Jing Xiangfeng <[email protected]>

Thanks, applied.

Paul.