diff options
author | Michael Thalmeier <michael.thalmeier@hale.at> | 2016-04-21 10:43:50 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-05-09 17:59:18 -0400 |
commit | b16931b13c67f06ca74cc8d02797de480dea348b (patch) | |
tree | 11240279a0355fc5f7e485d84fff85a3927d9357 /drivers/nfc | |
parent | 79f09fa79cefdd9df40c9c590cc8dda544ebff26 (diff) |
NFC: pn533: fix order of initialization
Correctly call nfc_set_parent_dev before nfc_register_device.
Otherwise the driver will OOPS when being removed.
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/pn533/i2c.c | 3 | ||||
-rw-r--r-- | drivers/nfc/pn533/pn533.c | 4 | ||||
-rw-r--r-- | drivers/nfc/pn533/pn533.h | 3 | ||||
-rw-r--r-- | drivers/nfc/pn533/usb.c | 3 |
4 files changed, 8 insertions, 5 deletions
diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c index 1a622e1c0a73..0141f19ac5a7 100644 --- a/drivers/nfc/pn533/i2c.c +++ b/drivers/nfc/pn533/i2c.c | |||
@@ -211,7 +211,8 @@ static int pn533_i2c_probe(struct i2c_client *client, | |||
211 | PN533_NO_TYPE_B_PROTOCOLS, | 211 | PN533_NO_TYPE_B_PROTOCOLS, |
212 | PN533_PROTO_REQ_ACK_RESP, | 212 | PN533_PROTO_REQ_ACK_RESP, |
213 | phy, &i2c_phy_ops, NULL, | 213 | phy, &i2c_phy_ops, NULL, |
214 | &phy->i2c_dev->dev); | 214 | &phy->i2c_dev->dev, |
215 | &client->dev); | ||
215 | 216 | ||
216 | if (IS_ERR(priv)) { | 217 | if (IS_ERR(priv)) { |
217 | r = PTR_ERR(priv); | 218 | r = PTR_ERR(priv); |
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index ee9e8f1195fa..d82eecd8daad 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c | |||
@@ -2554,7 +2554,8 @@ struct pn533 *pn533_register_device(u32 device_type, | |||
2554 | void *phy, | 2554 | void *phy, |
2555 | struct pn533_phy_ops *phy_ops, | 2555 | struct pn533_phy_ops *phy_ops, |
2556 | struct pn533_frame_ops *fops, | 2556 | struct pn533_frame_ops *fops, |
2557 | struct device *dev) | 2557 | struct device *dev, |
2558 | struct device *parent) | ||
2558 | { | 2559 | { |
2559 | struct pn533_fw_version fw_ver; | 2560 | struct pn533_fw_version fw_ver; |
2560 | struct pn533 *priv; | 2561 | struct pn533 *priv; |
@@ -2617,6 +2618,7 @@ struct pn533 *pn533_register_device(u32 device_type, | |||
2617 | goto destroy_wq; | 2618 | goto destroy_wq; |
2618 | } | 2619 | } |
2619 | 2620 | ||
2621 | nfc_set_parent_dev(priv->nfc_dev, parent); | ||
2620 | nfc_set_drvdata(priv->nfc_dev, priv); | 2622 | nfc_set_drvdata(priv->nfc_dev, priv); |
2621 | 2623 | ||
2622 | rc = nfc_register_device(priv->nfc_dev); | 2624 | rc = nfc_register_device(priv->nfc_dev); |
diff --git a/drivers/nfc/pn533/pn533.h b/drivers/nfc/pn533/pn533.h index ba604f6d93f9..553c7d171fd1 100644 --- a/drivers/nfc/pn533/pn533.h +++ b/drivers/nfc/pn533/pn533.h | |||
@@ -228,7 +228,8 @@ struct pn533 *pn533_register_device(u32 device_type, | |||
228 | void *phy, | 228 | void *phy, |
229 | struct pn533_phy_ops *phy_ops, | 229 | struct pn533_phy_ops *phy_ops, |
230 | struct pn533_frame_ops *fops, | 230 | struct pn533_frame_ops *fops, |
231 | struct device *dev); | 231 | struct device *dev, |
232 | struct device *parent); | ||
232 | 233 | ||
233 | void pn533_unregister_device(struct pn533 *priv); | 234 | void pn533_unregister_device(struct pn533 *priv); |
234 | void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status); | 235 | void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status); |
diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 4f73cbf8ccef..8ca060324b6a 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c | |||
@@ -536,7 +536,7 @@ static int pn533_usb_probe(struct usb_interface *interface, | |||
536 | 536 | ||
537 | priv = pn533_register_device(id->driver_info, protocols, protocol_type, | 537 | priv = pn533_register_device(id->driver_info, protocols, protocol_type, |
538 | phy, &usb_phy_ops, fops, | 538 | phy, &usb_phy_ops, fops, |
539 | &phy->udev->dev); | 539 | &phy->udev->dev, &interface->dev); |
540 | 540 | ||
541 | if (IS_ERR(priv)) { | 541 | if (IS_ERR(priv)) { |
542 | rc = PTR_ERR(priv); | 542 | rc = PTR_ERR(priv); |
@@ -544,7 +544,6 @@ static int pn533_usb_probe(struct usb_interface *interface, | |||
544 | } | 544 | } |
545 | 545 | ||
546 | phy->priv = priv; | 546 | phy->priv = priv; |
547 | nfc_set_parent_dev(priv->nfc_dev, &interface->dev); | ||
548 | 547 | ||
549 | usb_set_intfdata(interface, phy); | 548 | usb_set_intfdata(interface, phy); |
550 | 549 | ||