Skip to content

Commit a115d24

Browse files
wengjianfengdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5711ffd commit a115d24

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

drivers/nfc/pn533/i2c.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ static int pn533_i2c_send_ack(struct pn533 *dev, gfp_t flags)
4040
struct i2c_client *client = phy->i2c_dev;
4141
static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00};
4242
/* spec 6.2.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */
43-
int rc;
44-
45-
rc = i2c_master_send(client, ack, 6);
4643

47-
return rc;
44+
return i2c_master_send(client, ack, 6);
4845
}
4946

5047
static int pn533_i2c_send_frame(struct pn533 *dev,
@@ -199,8 +196,7 @@ static int pn533_i2c_probe(struct i2c_client *client,
199196
&phy->i2c_dev->dev);
200197

201198
if (IS_ERR(priv)) {
202-
r = PTR_ERR(priv);
203-
return r;
199+
return PTR_ERR(priv);
204200
}
205201

206202
phy->priv = priv;

drivers/nfc/pn533/pn533.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -489,25 +489,17 @@ static int pn533_send_data_async(struct pn533 *dev, u8 cmd_code,
489489
pn533_send_async_complete_t complete_cb,
490490
void *complete_cb_context)
491491
{
492-
int rc;
493-
494-
rc = __pn533_send_async(dev, cmd_code, req, complete_cb,
492+
return __pn533_send_async(dev, cmd_code, req, complete_cb,
495493
complete_cb_context);
496-
497-
return rc;
498494
}
499495

500496
static int pn533_send_cmd_async(struct pn533 *dev, u8 cmd_code,
501497
struct sk_buff *req,
502498
pn533_send_async_complete_t complete_cb,
503499
void *complete_cb_context)
504500
{
505-
int rc;
506-
507-
rc = __pn533_send_async(dev, cmd_code, req, complete_cb,
501+
return __pn533_send_async(dev, cmd_code, req, complete_cb,
508502
complete_cb_context);
509-
510-
return rc;
511503
}
512504

513505
/*
@@ -2620,7 +2612,7 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf)
26202612
return rc;
26212613
}
26222614

2623-
return rc;
2615+
return 0;
26242616
}
26252617

26262618
static int pn532_sam_configuration(struct nfc_dev *nfc_dev)
@@ -2794,7 +2786,6 @@ struct pn533 *pn53x_common_init(u32 device_type,
27942786
struct device *dev)
27952787
{
27962788
struct pn533 *priv;
2797-
int rc = -ENOMEM;
27982789

27992790
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
28002791
if (!priv)
@@ -2836,7 +2827,7 @@ struct pn533 *pn53x_common_init(u32 device_type,
28362827

28372828
error:
28382829
kfree(priv);
2839-
return ERR_PTR(rc);
2830+
return ERR_PTR(-ENOMEM);
28402831
}
28412832
EXPORT_SYMBOL_GPL(pn53x_common_init);
28422833

0 commit comments

Comments
 (0)