diff options
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/fdp/fdp.c | 49 | ||||
-rw-r--r-- | drivers/nfc/pn533/i2c.c | 8 | ||||
-rw-r--r-- | drivers/nfc/pn533/pn533.c | 20 | ||||
-rw-r--r-- | drivers/nfc/s3fwrn5/core.c | 12 | ||||
-rw-r--r-- | drivers/nfc/st-nci/spi.c | 7 |
5 files changed, 33 insertions, 63 deletions
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c index 4dc7bd7e02b6..fe0719ed81a0 100644 --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -176,7 +176,7 @@ static void fdp_nci_set_data_pkt_counter(struct nci_dev *ndev, * * The firmware will be analyzed and applied when we send NCI_OP_PROP_PATCH_CMD * command with NCI_PATCH_TYPE_EOT parameter. The device will send a - * NFCC_PATCH_NTF packaet and a NCI_OP_CORE_RESET_NTF packet. + * NFCC_PATCH_NTF packet and a NCI_OP_CORE_RESET_NTF packet. */ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) { @@ -236,15 +236,12 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) static int fdp_nci_open(struct nci_dev *ndev) { - int r; struct fdp_nci_info *info = nci_get_drvdata(ndev); struct device *dev = &info->phy->i2c_dev->dev; dev_dbg(dev, "%s\n", __func__); - r = info->phy_ops->enable(info->phy); - - return r; + return info->phy_ops->enable(info->phy); } static int fdp_nci_close(struct nci_dev *ndev) @@ -347,7 +344,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) int r = 0; if (info->otp_version >= info->otp_patch_version) - goto out; + return r; info->setup_patch_sent = 0; info->setup_reset_ntf = 0; @@ -356,19 +353,17 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) /* Patch init request */ r = fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_OTP); if (r) - goto out; + return r; /* Patch data connection creation */ conn_id = fdp_nci_create_conn(ndev); - if (conn_id < 0) { - r = conn_id; - goto out; - } + if (conn_id < 0) + return conn_id; /* Send the patch over the data connection */ r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_OTP); if (r) - goto out; + return r; /* Wait for all the packets to be send over i2c */ wait_event_interruptible(info->setup_wq, @@ -380,13 +375,12 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) /* Close the data connection */ r = nci_core_conn_close(info->ndev, conn_id); if (r) - goto out; + return r; /* Patch finish message */ if (fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_EOT)) { nfc_err(dev, "OTP patch error 0x%x\n", r); - r = -EINVAL; - goto out; + return -EINVAL; } /* If the patch notification didn't arrive yet, wait for it */ @@ -396,8 +390,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) r = info->setup_patch_status; if (r) { nfc_err(dev, "OTP patch error 0x%x\n", r); - r = -EINVAL; - goto out; + return -EINVAL; } /* @@ -406,7 +399,6 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) */ wait_event_interruptible(info->setup_wq, info->setup_reset_ntf); -out: return r; } @@ -418,7 +410,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) int r = 0; if (info->ram_version >= info->ram_patch_version) - goto out; + return r; info->setup_patch_sent = 0; info->setup_reset_ntf = 0; @@ -427,19 +419,17 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) /* Patch init request */ r = fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_RAM); if (r) - goto out; + return r; /* Patch data connection creation */ conn_id = fdp_nci_create_conn(ndev); - if (conn_id < 0) { - r = conn_id; - goto out; - } + if (conn_id < 0) + return conn_id; /* Send the patch over the data connection */ r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_RAM); if (r) - goto out; + return r; /* Wait for all the packets to be send over i2c */ wait_event_interruptible(info->setup_wq, @@ -451,13 +441,12 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) /* Close the data connection */ r = nci_core_conn_close(info->ndev, conn_id); if (r) - goto out; + return r; /* Patch finish message */ if (fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_EOT)) { nfc_err(dev, "RAM patch error 0x%x\n", r); - r = -EINVAL; - goto out; + return -EINVAL; } /* If the patch notification didn't arrive yet, wait for it */ @@ -467,8 +456,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) r = info->setup_patch_status; if (r) { nfc_err(dev, "RAM patch error 0x%x\n", r); - r = -EINVAL; - goto out; + return -EINVAL; } /* @@ -477,7 +465,6 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) */ wait_event_interruptible(info->setup_wq, info->setup_reset_ntf); -out: return r; } diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c index 0207e66cee21..795da9b85d56 100644 --- a/drivers/nfc/pn533/i2c.c +++ b/drivers/nfc/pn533/i2c.c @@ -40,11 +40,8 @@ static int pn533_i2c_send_ack(struct pn533 *dev, gfp_t flags) struct i2c_client *client = phy->i2c_dev; static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; /* spec 6.2.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ - int rc; - - rc = i2c_master_send(client, ack, 6); - return rc; + return i2c_master_send(client, ack, 6); } static int pn533_i2c_send_frame(struct pn533 *dev, @@ -199,8 +196,7 @@ static int pn533_i2c_probe(struct i2c_client *client, &phy->i2c_dev->dev); if (IS_ERR(priv)) { - r = PTR_ERR(priv); - return r; + return PTR_ERR(priv); } phy->priv = priv; diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index f1469ac8ff42..2c7f9916f206 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -489,12 +489,8 @@ static int pn533_send_data_async(struct pn533 *dev, u8 cmd_code, pn533_send_async_complete_t complete_cb, void *complete_cb_context) { - int rc; - - rc = __pn533_send_async(dev, cmd_code, req, complete_cb, + return __pn533_send_async(dev, cmd_code, req, complete_cb, complete_cb_context); - - return rc; } static int pn533_send_cmd_async(struct pn533 *dev, u8 cmd_code, @@ -502,12 +498,8 @@ static int pn533_send_cmd_async(struct pn533 *dev, u8 cmd_code, pn533_send_async_complete_t complete_cb, void *complete_cb_context) { - int rc; - - rc = __pn533_send_async(dev, cmd_code, req, complete_cb, + return __pn533_send_async(dev, cmd_code, req, complete_cb, complete_cb_context); - - return rc; } /* @@ -706,6 +698,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a, if (PN533_TYPE_A_SEL_CASCADE(type_a->sel_res) != 0) return false; + if (type_a->nfcid_len > NFC_NFCID1_MAXSIZE) + return false; + return true; } @@ -2617,7 +2612,7 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf) return rc; } - return rc; + return 0; } static int pn532_sam_configuration(struct nfc_dev *nfc_dev) @@ -2791,7 +2786,6 @@ struct pn533 *pn53x_common_init(u32 device_type, struct device *dev) { struct pn533 *priv; - int rc = -ENOMEM; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) @@ -2833,7 +2827,7 @@ struct pn533 *pn53x_common_init(u32 device_type, error: kfree(priv); - return ERR_PTR(rc); + return ERR_PTR(-ENOMEM); } EXPORT_SYMBOL_GPL(pn53x_common_init); diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c index c00b7a07c3ee..865d3e3d1528 100644 --- a/drivers/nfc/s3fwrn5/core.c +++ b/drivers/nfc/s3fwrn5/core.c @@ -124,13 +124,12 @@ static int s3fwrn5_nci_post_setup(struct nci_dev *ndev) if (s3fwrn5_firmware_init(info)) { //skip bootloader mode - ret = 0; - goto out; + return 0; } ret = s3fwrn5_firmware_update(info); if (ret < 0) - goto out; + return ret; /* NCI core reset */ @@ -139,12 +138,9 @@ static int s3fwrn5_nci_post_setup(struct nci_dev *ndev) ret = nci_core_reset(info->ndev); if (ret < 0) - goto out; - - ret = nci_core_init(info->ndev); + return ret; -out: - return ret; + return nci_core_init(info->ndev); } static struct nci_ops s3fwrn5_nci_ops = { diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c index 8db323adebf0..09df6ea65840 100644 --- a/drivers/nfc/st-nci/spi.c +++ b/drivers/nfc/st-nci/spi.c @@ -95,17 +95,14 @@ static int st_nci_spi_write(void *phy_id, struct sk_buff *skb) */ if (!r) { skb_rx = alloc_skb(skb->len, GFP_KERNEL); - if (!skb_rx) { - r = -ENOMEM; - goto exit; - } + if (!skb_rx) + return -ENOMEM; skb_put(skb_rx, skb->len); memcpy(skb_rx->data, buf, skb->len); ndlc_recv(phy->ndlc, skb_rx); } -exit: return r; } |