* [Qemu-devel] [PATCH] net/rocker: Cleanup the useless return value check
@ 2017-05-24 2:57 Mao Zhongyi
2017-05-24 3:31 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: Mao Zhongyi @ 2017-05-24 2:57 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, jiri, jasowang
None of pci_dma_read()'s callers check the return value except
rocker. There is no need to check it because it always return
0. So the check work is useless. Remove it entirely.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
---
hw/net/rocker/rocker.c | 9 +++------
hw/net/rocker/rocker_desc.c | 4 +---
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
index 6e70fdd..4f0f6d7 100644
--- a/hw/net/rocker/rocker.c
+++ b/hw/net/rocker/rocker.c
@@ -244,11 +244,9 @@ static int tx_consume(Rocker *r, DescInfo *info)
goto err_no_mem;
}
- if (pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
- iov[iovcnt].iov_len)) {
- err = -ROCKER_ENXIO;
- goto err_bad_io;
- }
+ pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
+ iov[iovcnt].iov_len);
+
iovcnt++;
}
@@ -261,7 +259,6 @@ static int tx_consume(Rocker *r, DescInfo *info)
err = fp_port_eg(r->fp_port[port], iov, iovcnt);
err_too_many_frags:
-err_bad_io:
err_no_mem:
err_bad_attr:
for (i = 0; i < ROCKER_TX_FRAGS_MAX; i++) {
diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c
index ac02797..6184c40 100644
--- a/hw/net/rocker/rocker_desc.c
+++ b/hw/net/rocker/rocker_desc.c
@@ -69,9 +69,7 @@ char *desc_get_buf(DescInfo *info, bool read_only)
return NULL;
}
- if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) {
- return NULL;
- }
+ pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size);
return info->buf;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] net/rocker: Cleanup the useless return value check
2017-05-24 2:57 [Qemu-devel] [PATCH] net/rocker: Cleanup the useless return value check Mao Zhongyi
@ 2017-05-24 3:31 ` Jason Wang
2017-05-24 4:17 ` Mao Zhongyi
0 siblings, 1 reply; 3+ messages in thread
From: Jason Wang @ 2017-05-24 3:31 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: jiri, armbru
On 2017年05月24日 10:57, Mao Zhongyi wrote:
> None of pci_dma_read()'s callers check the return value except
> rocker. There is no need to check it because it always return
> 0. So the check work is useless. Remove it entirely.
>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
> hw/net/rocker/rocker.c | 9 +++------
> hw/net/rocker/rocker_desc.c | 4 +---
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
> index 6e70fdd..4f0f6d7 100644
> --- a/hw/net/rocker/rocker.c
> +++ b/hw/net/rocker/rocker.c
> @@ -244,11 +244,9 @@ static int tx_consume(Rocker *r, DescInfo *info)
> goto err_no_mem;
> }
>
> - if (pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
> - iov[iovcnt].iov_len)) {
> - err = -ROCKER_ENXIO;
> - goto err_bad_io;
> - }
> + pci_dma_read(dev, frag_addr, iov[iovcnt].iov_base,
> + iov[iovcnt].iov_len);
> +
> iovcnt++;
> }
>
> @@ -261,7 +259,6 @@ static int tx_consume(Rocker *r, DescInfo *info)
> err = fp_port_eg(r->fp_port[port], iov, iovcnt);
>
> err_too_many_frags:
> -err_bad_io:
> err_no_mem:
> err_bad_attr:
> for (i = 0; i < ROCKER_TX_FRAGS_MAX; i++) {
> diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c
> index ac02797..6184c40 100644
> --- a/hw/net/rocker/rocker_desc.c
> +++ b/hw/net/rocker/rocker_desc.c
> @@ -69,9 +69,7 @@ char *desc_get_buf(DescInfo *info, bool read_only)
> return NULL;
> }
>
> - if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) {
> - return NULL;
> - }
> + pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size);
>
> return info->buf;
> }
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] net/rocker: Cleanup the useless return value check
2017-05-24 3:31 ` Jason Wang
@ 2017-05-24 4:17 ` Mao Zhongyi
0 siblings, 0 replies; 3+ messages in thread
From: Mao Zhongyi @ 2017-05-24 4:17 UTC (permalink / raw)
To: Jason Wang, qemu-devel; +Cc: jiri, armbru
On 05/24/2017 11:31 AM, Jason Wang wrote:
>
>
> On 2017年05月24日 10:57, Mao Zhongyi wrote:
>> None of pci_dma_read()'s callers check the return value except
>> rocker. There is no need to check it because it always return
>> 0. So the check work is useless. Remove it entirely.
>>
>> Suggested-by: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
>> ---
[...]
>
> Applied, thanks.
Thanks:)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-24 4:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-24 2:57 [Qemu-devel] [PATCH] net/rocker: Cleanup the useless return value check Mao Zhongyi
2017-05-24 3:31 ` Jason Wang
2017-05-24 4:17 ` Mao Zhongyi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).