2020-01-16 03:15:42

by Gen Zhang

[permalink] [raw]
Subject: [PATCH] net: nfc: Removing unnecessaey code in nci_open_device()

In nci_open_device(), since we already call clear_bit(), so set ndev->flags
to 0 is not needed.

Signed-off-by: Gen Zhang <[email protected]>
---
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 7cd5248..25dae74 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -522,7 +522,6 @@ static int nci_open_device(struct nci_dev *ndev)
skb_queue_purge(&ndev->tx_q);

ndev->ops->close(ndev);
- ndev->flags = 0;
}

done:


2020-01-16 09:18:17

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] net: nfc: Removing unnecessaey code in nci_open_device()

From: Gen Zhang <[email protected]>
Date: Thu, 16 Jan 2020 10:52:04 +0800

> In nci_open_device(), since we already call clear_bit(), so set ndev->flags
> to 0 is not needed.
>
> Signed-off-by: Gen Zhang <[email protected]>

There are several bits in this flags value, not just the one managed
here in this function (NCI_INIT).

This assignment is harmless and makes the code easier to audit,
therefore I am not applying this patch.