History

vdpasim: Fix some coccinelle warnings

Fix below warnings reported by coccicheck: drivers/vdpa/vdpa_sim/vdpa_sim.c:104:1-10: WARNING: Assignment of 0/1 to bool variable drivers/vdpa/vdpa_sim/vdpa_sim.c:164:7-11: WARNING: Unsigned expression compared with zero: read <= 0 drivers/vdpa/vdpa_sim/vdpa_sim.c:169:7-12: WARNING: Unsigned expression compared with zero: write <= 0 1. The 'ready' variable in vdpasim_virtqueue struct is bool type. It is better to initialize vq->ready to false 2. Modify 'read' and 'write' variables type from size_t to ssize_t. And preserve the reverse christmas tree ordering of local variables.

Samuel Zou committed 6 years ago

Commit 18e643c1 parent 7dd793f1 file · +4 −3Browse files

Unified · Split

drivers/vdpa/vdpa_sim/vdpa_sim.c+4−3
@@ -101,7 +101,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) · 100 unmodified lines
101101
102102 static void vdpasim_vq_reset(struct vdpasim_virtqueue *vq)
103103 {
104− vq->ready = 0;
104+ vq->ready = false;
105105 vq->desc_addr = 0;
106106 vq->driver_addr = 0;
107107 vq->device_addr = 0;
@@ -131,9 +131,10 @@ static void vdpasim_work(struct work_struct *work) · 23 unmodified lines
131131 vdpasim, work);
132132 struct vdpasim_virtqueue *txq = &vdpasim->vqs[1];
133133 struct vdpasim_virtqueue *rxq = &vdpasim->vqs[0];
134− size_t read, write, total_write;
135− int err;
134+ ssize_t read, write;
135+ size_t total_write;
136136 int pkts = 0;
137+ int err;
137138
138139 spin_lock(&vdpasim->lock);
139140

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t