summaryrefslogtreecommitdiff
path: root/drivers/nfc/pn533/pn533.c
diff options
context:
space:
mode:
authorwengjianfeng <wengjianfeng@yulong.com>2021-04-12 05:20:06 +0300
committerDavid S. Miller <davem@davemloft.net>2021-04-12 23:23:03 +0300
commita115d24a636e892ddd1ae58f8e23c78a0390cb68 (patch)
treea52dd32aa2cee8b8b6d92819cec29f9eb507f82a /drivers/nfc/pn533/pn533.c
parent5711ffd31355e17d87710e7691899409a640f58a (diff)
downloadlinux-a115d24a636e892ddd1ae58f8e23c78a0390cb68.tar.xz
nfc: pn533: remove redundant assignment
In many places,first assign a value to a variable and then return the variable. which is redundant, we should directly return the value. in pn533_rf_field funciton,return rc also in the if statement, so we use return 0 to replace the last return rc. Signed-off-by: wengjianfeng <wengjianfeng@yulong.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc/pn533/pn533.c')
-rw-r--r--drivers/nfc/pn533/pn533.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
index 3fe5b81eda2d..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;
}
/*
@@ -2620,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)
@@ -2794,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)
@@ -2836,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);