]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NFC: digital: Rework error handling in DEP_RES response
authorThierry Escande <thierry.escande@collabora.com>
Thu, 16 Jun 2016 18:24:42 +0000 (20:24 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 6 Jul 2016 08:08:57 +0000 (10:08 +0200)
The Digital Protocol stack used to send a NACK frame whatever the error
type it receives in digital_in_recv_dep_res(). It actually should only
send a NACK frame on CRC or parity check errors or on any transmission
error if a NACK frame was previously sent. Existing drivers used to send
EIO error for this kind of issues so this patch limits sending of NACK
frames on EIO errors. All other errors will be reported to the upper
layers.

Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/digital_dep.c

index f72be7433df35fc1acfa3105a151b40876c0d47f..b62c85dc12a2e5b6666c69b75a7c6272a6a4573f 100644 (file)
@@ -664,7 +664,7 @@ static void digital_in_recv_dep_res(struct nfc_digital_dev *ddev, void *arg,
                rc = PTR_ERR(resp);
                resp = NULL;
 
-               if (((rc != -ETIMEDOUT) || ddev->nack_count) &&
+               if ((rc == -EIO || (rc == -ETIMEDOUT && ddev->nack_count)) &&
                    (ddev->nack_count++ < DIGITAL_NFC_DEP_N_RETRY_NACK)) {
                        ddev->atn_count = 0;