linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] vdpasim: remove unused variable 'ret'
@ 2020-04-10 11:54 YueHaibing
  2020-05-06  0:35 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2020-04-10 11:54 UTC (permalink / raw)
  To: mst, jasowang, yuehaibing; +Cc: virtualization, linux-kernel

drivers/vdpa/vdpa_sim/vdpa_sim.c:92:6: warning:
 variable ‘ret’ set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/vdpa/vdpa_sim/vdpa_sim.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index 7957d2d41fc4..01c456f7c1f7 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -89,15 +89,14 @@ static struct vdpasim *dev_to_sim(struct device *dev)
 static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
 {
 	struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
-	int ret;
 
-	ret = vringh_init_iotlb(&vq->vring, vdpasim_features,
-				VDPASIM_QUEUE_MAX, false,
-				(struct vring_desc *)(uintptr_t)vq->desc_addr,
-				(struct vring_avail *)
-				(uintptr_t)vq->driver_addr,
-				(struct vring_used *)
-				(uintptr_t)vq->device_addr);
+	vringh_init_iotlb(&vq->vring, vdpasim_features,
+			  VDPASIM_QUEUE_MAX, false,
+			  (struct vring_desc *)(uintptr_t)vq->desc_addr,
+			  (struct vring_avail *)
+			  (uintptr_t)vq->driver_addr,
+			  (struct vring_used *)
+			  (uintptr_t)vq->device_addr);
 }
 
 static void vdpasim_vq_reset(struct vdpasim_virtqueue *vq)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] vdpasim: remove unused variable 'ret'
  2020-04-10 11:54 [PATCH -next] vdpasim: remove unused variable 'ret' YueHaibing
@ 2020-05-06  0:35 ` Michael S. Tsirkin
  2020-05-08  6:57   ` Jason Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-05-06  0:35 UTC (permalink / raw)
  To: YueHaibing; +Cc: jasowang, virtualization, linux-kernel

On Fri, Apr 10, 2020 at 07:54:22PM +0800, YueHaibing wrote:
> drivers/vdpa/vdpa_sim/vdpa_sim.c:92:6: warning:
>  variable ‘ret’ set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---

Either this, or BUG_ON.  Jason?

>  drivers/vdpa/vdpa_sim/vdpa_sim.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index 7957d2d41fc4..01c456f7c1f7 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -89,15 +89,14 @@ static struct vdpasim *dev_to_sim(struct device *dev)
>  static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
>  {
>  	struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
> -	int ret;
>  
> -	ret = vringh_init_iotlb(&vq->vring, vdpasim_features,
> -				VDPASIM_QUEUE_MAX, false,
> -				(struct vring_desc *)(uintptr_t)vq->desc_addr,
> -				(struct vring_avail *)
> -				(uintptr_t)vq->driver_addr,
> -				(struct vring_used *)
> -				(uintptr_t)vq->device_addr);
> +	vringh_init_iotlb(&vq->vring, vdpasim_features,
> +			  VDPASIM_QUEUE_MAX, false,
> +			  (struct vring_desc *)(uintptr_t)vq->desc_addr,
> +			  (struct vring_avail *)
> +			  (uintptr_t)vq->driver_addr,
> +			  (struct vring_used *)
> +			  (uintptr_t)vq->device_addr);
>  }
>  
>  static void vdpasim_vq_reset(struct vdpasim_virtqueue *vq)
> -- 
> 2.17.1
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] vdpasim: remove unused variable 'ret'
  2020-05-06  0:35 ` Michael S. Tsirkin
@ 2020-05-08  6:57   ` Jason Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2020-05-08  6:57 UTC (permalink / raw)
  To: Michael S. Tsirkin, YueHaibing; +Cc: virtualization, linux-kernel


On 2020/5/6 上午8:35, Michael S. Tsirkin wrote:
> On Fri, Apr 10, 2020 at 07:54:22PM +0800, YueHaibing wrote:
>> drivers/vdpa/vdpa_sim/vdpa_sim.c:92:6: warning:
>>   variable ‘ret’ set but not used [-Wunused-but-set-variable]
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
> Either this, or BUG_ON.  Jason?


BUG_ON seems too aggressive. So I prefer this patch.

Acked-by: Jason Wang <jasowang@redhat.com>


>
>>   drivers/vdpa/vdpa_sim/vdpa_sim.c | 15 +++++++--------
>>   1 file changed, 7 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>> index 7957d2d41fc4..01c456f7c1f7 100644
>> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
>> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>> @@ -89,15 +89,14 @@ static struct vdpasim *dev_to_sim(struct device *dev)
>>   static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
>>   {
>>   	struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
>> -	int ret;
>>   
>> -	ret = vringh_init_iotlb(&vq->vring, vdpasim_features,
>> -				VDPASIM_QUEUE_MAX, false,
>> -				(struct vring_desc *)(uintptr_t)vq->desc_addr,
>> -				(struct vring_avail *)
>> -				(uintptr_t)vq->driver_addr,
>> -				(struct vring_used *)
>> -				(uintptr_t)vq->device_addr);
>> +	vringh_init_iotlb(&vq->vring, vdpasim_features,
>> +			  VDPASIM_QUEUE_MAX, false,
>> +			  (struct vring_desc *)(uintptr_t)vq->desc_addr,
>> +			  (struct vring_avail *)
>> +			  (uintptr_t)vq->driver_addr,
>> +			  (struct vring_used *)
>> +			  (uintptr_t)vq->device_addr);
>>   }
>>   
>>   static void vdpasim_vq_reset(struct vdpasim_virtqueue *vq)
>> -- 
>> 2.17.1
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-08  6:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 11:54 [PATCH -next] vdpasim: remove unused variable 'ret' YueHaibing
2020-05-06  0:35 ` Michael S. Tsirkin
2020-05-08  6:57   ` Jason Wang

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).