summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533/pn533.c
diff options
context:
space:
mode:
authorLars Poeschel <poeschel@lemonage.de>2019-11-13 14:50:22 +0100
committerDavid S. Miller <davem@davemloft.net>2019-11-13 12:15:03 -0800
commit1e37be7d27d086ca72c38af14a9783eb9d7e9fa9 (patch)
tree3939db915c22bbabb562fd07098289ec93f8c591 /drivers/nfc/pn533/pn533.c
parentd73cfd4283d9090b45337a93dddc43848039f14b (diff)
downloadlinux-1e37be7d27d086ca72c38af14a9783eb9d7e9fa9.tar.bz2
nfc: pn533: pn533_phy_ops dev_[up, down] return int
Change dev_up and dev_down functions of struct pn533_phy_ops to return int. This way the pn533 core can report errors in the phy layer to upper layers. The only user of this is currently uart.c and it is changed to report the error of a possibly failing call to serdev_device_open. Reported-by: coverity-bot <keescook+coverity-bot@chromium.org> Addresses-Coverity-ID: 1487395 ("Error handling issues") Fixes: c656aa4c27b1 ("nfc: pn533: add UART phy driver") Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc/pn533/pn533.c')
-rw-r--r--drivers/nfc/pn533/pn533.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
index aa766e7ece70..346e084387f7 100644
--- a/drivers/nfc/pn533/pn533.c
+++ b/drivers/nfc/pn533/pn533.c
@@ -2643,13 +2643,17 @@ static int pn532_sam_configuration(struct nfc_dev *nfc_dev)
static int pn533_dev_up(struct nfc_dev *nfc_dev)
{
struct pn533 *dev = nfc_get_drvdata(nfc_dev);
+ int rc;
- if (dev->phy_ops->dev_up)
- dev->phy_ops->dev_up(dev);
+ if (dev->phy_ops->dev_up) {
+ rc = dev->phy_ops->dev_up(dev);
+ if (rc)
+ return rc;
+ }
if ((dev->device_type == PN533_DEVICE_PN532) ||
(dev->device_type == PN533_DEVICE_PN532_AUTOPOLL)) {
- int rc = pn532_sam_configuration(nfc_dev);
+ rc = pn532_sam_configuration(nfc_dev);
if (rc)
return rc;
@@ -2665,7 +2669,7 @@ static int pn533_dev_down(struct nfc_dev *nfc_dev)
ret = pn533_rf_field(nfc_dev, 0);
if (dev->phy_ops->dev_down && !ret)
- dev->phy_ops->dev_down(dev);
+ ret = dev->phy_ops->dev_down(dev);
return ret;
}