[PATCH] staging: vt6655: Use GFP_KERNEL in kzalloc

From: Jia-Ju Bai
Date: Mon Dec 18 2017 - 04:05:46 EST


Four kzalloc functions are called with GFP_ATOMIC.
But according to driver call graph, they are not in atomic context,
namely no spinlock is held nor in an interrupt handler.

All these "GFP_ATOMIC"s are unnecessary,
and replace with with "GFP_KERNEL"s.

Signed-off-by: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>
---
drivers/staging/vt6655/device_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 1123b4f..1688307 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -547,7 +547,7 @@ static void device_init_rd0_ring(struct vnt_private *priv)
for (i = 0; i < priv->opts.rx_descs0;
i ++, curr += sizeof(struct vnt_rx_desc)) {
desc = &priv->aRD0Ring[i];
- desc->rd_info = kzalloc(sizeof(*desc->rd_info), GFP_ATOMIC);
+ desc->rd_info = kzalloc(sizeof(*desc->rd_info), GFP_KERNEL);

if (!device_alloc_rx_buf(priv, desc))
dev_err(&priv->pcid->dev, "can not alloc rx bufs\n");
@@ -571,7 +571,7 @@ static void device_init_rd1_ring(struct vnt_private *priv)
for (i = 0; i < priv->opts.rx_descs1;
i ++, curr += sizeof(struct vnt_rx_desc)) {
desc = &priv->aRD1Ring[i];
- desc->rd_info = kzalloc(sizeof(*desc->rd_info), GFP_ATOMIC);
+ desc->rd_info = kzalloc(sizeof(*desc->rd_info), GFP_KERNEL);

if (!device_alloc_rx_buf(priv, desc))
dev_err(&priv->pcid->dev, "can not alloc rx bufs\n");
@@ -629,7 +629,7 @@ static void device_init_td0_ring(struct vnt_private *priv)
for (i = 0; i < priv->opts.tx_descs[0];
i++, curr += sizeof(struct vnt_tx_desc)) {
desc = &priv->apTD0Rings[i];
- desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_ATOMIC);
+ desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_KERNEL);

desc->td_info->buf = priv->tx0_bufs + i * PKT_BUF_SZ;
desc->td_info->buf_dma = priv->tx_bufs_dma0 + i * PKT_BUF_SZ;
@@ -654,7 +654,7 @@ static void device_init_td1_ring(struct vnt_private *priv)
for (i = 0; i < priv->opts.tx_descs[1];
i++, curr += sizeof(struct vnt_tx_desc)) {
desc = &priv->apTD1Rings[i];
- desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_ATOMIC);
+ desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_KERNEL);

desc->td_info->buf = priv->tx1_bufs + i * PKT_BUF_SZ;
desc->td_info->buf_dma = priv->tx_bufs_dma1 + i * PKT_BUF_SZ;
--
1.7.9.5