summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2018-07-12 10:10:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-12 10:23:19 -0400
commit5151e2b578e92f88d676ad78d36a2ef93d0a0dea (patch)
tree4eae9d2c2162fa6d91216d528e3d9b28c35260a1 /drivers/misc
parent44c98df01851c0d5941b06c60d1bd092bac088c3 (diff)
mei: fix ssize_t to int assignment in read and write ops.
Use ssize_t for rets variables in mei_write(), mei_read(), and mei_cl_write() as well as change the return type of mei_cl_write() to ssize_t, to prevent assignment of possible 64bit size_t to int 32 bit variable. As by product also eliminate warning drivers/misc/mei/client.c:1702:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/client.c22
-rw-r--r--drivers/misc/mei/client.h2
-rw-r--r--drivers/misc/mei/main.c10
3 files changed, 17 insertions, 17 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index f8fb7589192e..5a673d09585f 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -1644,13 +1644,13 @@ err:
1644 * 1644 *
1645 * Return: number of bytes sent on success, <0 on failure. 1645 * Return: number of bytes sent on success, <0 on failure.
1646 */ 1646 */
1647int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb) 1647ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb)
1648{ 1648{
1649 struct mei_device *dev; 1649 struct mei_device *dev;
1650 struct mei_msg_data *buf; 1650 struct mei_msg_data *buf;
1651 struct mei_msg_hdr mei_hdr; 1651 struct mei_msg_hdr mei_hdr;
1652 int size; 1652 size_t len;
1653 int rets; 1653 ssize_t rets;
1654 bool blocking; 1654 bool blocking;
1655 1655
1656 if (WARN_ON(!cl || !cl->dev)) 1656 if (WARN_ON(!cl || !cl->dev))
@@ -1662,15 +1662,15 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb)
1662 dev = cl->dev; 1662 dev = cl->dev;
1663 1663
1664 buf = &cb->buf; 1664 buf = &cb->buf;
1665 size = buf->size; 1665 len = buf->size;
1666 blocking = cb->blocking; 1666 blocking = cb->blocking;
1667 1667
1668 cl_dbg(dev, cl, "size=%d\n", size); 1668 cl_dbg(dev, cl, "len=%zd\n", len);
1669 1669
1670 rets = pm_runtime_get(dev->dev); 1670 rets = pm_runtime_get(dev->dev);
1671 if (rets < 0 && rets != -EINPROGRESS) { 1671 if (rets < 0 && rets != -EINPROGRESS) {
1672 pm_runtime_put_noidle(dev->dev); 1672 pm_runtime_put_noidle(dev->dev);
1673 cl_err(dev, cl, "rpm: get failed %d\n", rets); 1673 cl_err(dev, cl, "rpm: get failed %zd\n", rets);
1674 goto free; 1674 goto free;
1675 } 1675 }
1676 1676
@@ -1689,21 +1689,21 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb)
1689 1689
1690 if (rets == 0) { 1690 if (rets == 0) {
1691 cl_dbg(dev, cl, "No flow control credentials: not sending.\n"); 1691 cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
1692 rets = size; 1692 rets = len;
1693 goto out; 1693 goto out;
1694 } 1694 }
1695 if (!mei_hbuf_acquire(dev)) { 1695 if (!mei_hbuf_acquire(dev)) {
1696 cl_dbg(dev, cl, "Cannot acquire the host buffer: not sending.\n"); 1696 cl_dbg(dev, cl, "Cannot acquire the host buffer: not sending.\n");
1697 rets = size; 1697 rets = len;
1698 goto out; 1698 goto out;
1699 } 1699 }
1700 1700
1701 /* Check for a maximum length */ 1701 /* Check for a maximum length */
1702 if (size > mei_hbuf_max_len(dev)) { 1702 if (len > mei_hbuf_max_len(dev)) {
1703 mei_hdr.length = mei_hbuf_max_len(dev); 1703 mei_hdr.length = mei_hbuf_max_len(dev);
1704 mei_hdr.msg_complete = 0; 1704 mei_hdr.msg_complete = 0;
1705 } else { 1705 } else {
1706 mei_hdr.length = size; 1706 mei_hdr.length = len;
1707 mei_hdr.msg_complete = 1; 1707 mei_hdr.msg_complete = 1;
1708 } 1708 }
1709 1709
@@ -1745,7 +1745,7 @@ out:
1745 } 1745 }
1746 } 1746 }
1747 1747
1748 rets = size; 1748 rets = len;
1749err: 1749err:
1750 cl_dbg(dev, cl, "rpm: autosuspend\n"); 1750 cl_dbg(dev, cl, "rpm: autosuspend\n");
1751 pm_runtime_mark_last_busy(dev->dev); 1751 pm_runtime_mark_last_busy(dev->dev);
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index 5371df4d8af3..64e318f589b4 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -202,7 +202,7 @@ int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl,
202int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, 202int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
203 struct list_head *cmpl_list); 203 struct list_head *cmpl_list);
204int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp); 204int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp);
205int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb); 205ssize_t mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb);
206int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, 206int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
207 struct list_head *cmpl_list); 207 struct list_head *cmpl_list);
208 208
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 302ba7a63bd2..4d77a6ae183a 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -137,7 +137,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
137 struct mei_device *dev; 137 struct mei_device *dev;
138 struct mei_cl_cb *cb = NULL; 138 struct mei_cl_cb *cb = NULL;
139 bool nonblock = !!(file->f_flags & O_NONBLOCK); 139 bool nonblock = !!(file->f_flags & O_NONBLOCK);
140 int rets; 140 ssize_t rets;
141 141
142 if (WARN_ON(!cl || !cl->dev)) 142 if (WARN_ON(!cl || !cl->dev))
143 return -ENODEV; 143 return -ENODEV;
@@ -170,7 +170,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
170 170
171 rets = mei_cl_read_start(cl, length, file); 171 rets = mei_cl_read_start(cl, length, file);
172 if (rets && rets != -EBUSY) { 172 if (rets && rets != -EBUSY) {
173 cl_dbg(dev, cl, "mei start read failure status = %d\n", rets); 173 cl_dbg(dev, cl, "mei start read failure status = %zd\n", rets);
174 goto out; 174 goto out;
175 } 175 }
176 176
@@ -204,7 +204,7 @@ copy_buffer:
204 /* now copy the data to user space */ 204 /* now copy the data to user space */
205 if (cb->status) { 205 if (cb->status) {
206 rets = cb->status; 206 rets = cb->status;
207 cl_dbg(dev, cl, "read operation failed %d\n", rets); 207 cl_dbg(dev, cl, "read operation failed %zd\n", rets);
208 goto free; 208 goto free;
209 } 209 }
210 210
@@ -236,7 +236,7 @@ free:
236 *offset = 0; 236 *offset = 0;
237 237
238out: 238out:
239 cl_dbg(dev, cl, "end mei read rets = %d\n", rets); 239 cl_dbg(dev, cl, "end mei read rets = %zd\n", rets);
240 mutex_unlock(&dev->device_lock); 240 mutex_unlock(&dev->device_lock);
241 return rets; 241 return rets;
242} 242}
@@ -256,7 +256,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
256 struct mei_cl *cl = file->private_data; 256 struct mei_cl *cl = file->private_data;
257 struct mei_cl_cb *cb; 257 struct mei_cl_cb *cb;
258 struct mei_device *dev; 258 struct mei_device *dev;
259 int rets; 259 ssize_t rets;
260 260
261 if (WARN_ON(!cl || !cl->dev)) 261 if (WARN_ON(!cl || !cl->dev))
262 return -ENODEV; 262 return -ENODEV;