2020-10-12 13:29:10

by David Hildenbrand

[permalink] [raw]
Subject: [PATCH v1 04/29] virtio-mem: drop rc2 in virtio_mem_mb_plug_and_add()

We can drop rc2, we don't actually need the value.

Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Pankaj Gupta <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
---
drivers/virtio/virtio_mem.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index 78c2fbcddcf8..b3eebac7191f 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -1072,7 +1072,7 @@ static int virtio_mem_mb_plug_and_add(struct virtio_mem *vm,
uint64_t *nb_sb)
{
const int count = min_t(int, *nb_sb, vm->nb_sb_per_mb);
- int rc, rc2;
+ int rc;

if (WARN_ON_ONCE(!count))
return -EINVAL;
@@ -1103,13 +1103,12 @@ static int virtio_mem_mb_plug_and_add(struct virtio_mem *vm,

dev_err(&vm->vdev->dev,
"adding memory block %lu failed with %d\n", mb_id, rc);
- rc2 = virtio_mem_mb_unplug_sb(vm, mb_id, 0, count);

/*
* TODO: Linux MM does not properly clean up yet in all cases
* where adding of memory failed - especially on -ENOMEM.
*/
- if (rc2)
+ if (virtio_mem_mb_unplug_sb(vm, mb_id, 0, count))
new_state = VIRTIO_MEM_MB_STATE_PLUGGED;
virtio_mem_mb_set_state(vm, mb_id, new_state);
return rc;
--
2.26.2


2020-10-12 13:37:11

by Pankaj Gupta

[permalink] [raw]
Subject: Re: [PATCH v1 04/29] virtio-mem: drop rc2 in virtio_mem_mb_plug_and_add()

> Cc: "Michael S. Tsirkin" <[email protected]>
> Cc: Jason Wang <[email protected]>
> Cc: Pankaj Gupta <[email protected]>
> Signed-off-by: David Hildenbrand <[email protected]>
> ---
> drivers/virtio/virtio_mem.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index 78c2fbcddcf8..b3eebac7191f 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -1072,7 +1072,7 @@ static int virtio_mem_mb_plug_and_add(struct virtio_mem *vm,
> uint64_t *nb_sb)
> {
> const int count = min_t(int, *nb_sb, vm->nb_sb_per_mb);
> - int rc, rc2;
> + int rc;
>
> if (WARN_ON_ONCE(!count))
> return -EINVAL;
> @@ -1103,13 +1103,12 @@ static int virtio_mem_mb_plug_and_add(struct virtio_mem *vm,
>
> dev_err(&vm->vdev->dev,
> "adding memory block %lu failed with %d\n", mb_id, rc);
> - rc2 = virtio_mem_mb_unplug_sb(vm, mb_id, 0, count);
>
> /*
> * TODO: Linux MM does not properly clean up yet in all cases
> * where adding of memory failed - especially on -ENOMEM.
> */
> - if (rc2)
> + if (virtio_mem_mb_unplug_sb(vm, mb_id, 0, count))
> new_state = VIRTIO_MEM_MB_STATE_PLUGGED;
> virtio_mem_mb_set_state(vm, mb_id, new_state);
> return rc;

Reviewed-by: Pankaj Gupta <[email protected]>

2020-10-15 18:22:50

by Wei Yang

[permalink] [raw]
Subject: Re: [PATCH v1 04/29] virtio-mem: drop rc2 in virtio_mem_mb_plug_and_add()

On Mon, Oct 12, 2020 at 02:52:58PM +0200, David Hildenbrand wrote:
>We can drop rc2, we don't actually need the value.
>
>Cc: "Michael S. Tsirkin" <[email protected]>
>Cc: Jason Wang <[email protected]>
>Cc: Pankaj Gupta <[email protected]>
>Signed-off-by: David Hildenbrand <[email protected]>

Reviewed-by: Wei Yang <[email protected]>


--
Wei Yang
Help you, Help me