NFC: pn533: fix order of initialization
authorMichael Thalmeier <michael.thalmeier@hale.at>
Thu, 21 Apr 2016 14:43:50 +0000 (16:43 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 9 May 2016 21:59:18 +0000 (23:59 +0200)
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>
drivers/nfc/pn533/i2c.c
drivers/nfc/pn533/pn533.c
drivers/nfc/pn533/pn533.h
drivers/nfc/pn533/usb.c

index 1a622e1c0a730ac1ac63f6ba1ba2af42c7a22726..0141f19ac5a728e575fe6534a855ba3aadab7f70 100644 (file)
@@ -211,7 +211,8 @@ static int pn533_i2c_probe(struct i2c_client *client,
                                     PN533_NO_TYPE_B_PROTOCOLS,
                                     PN533_PROTO_REQ_ACK_RESP,
                                     phy, &i2c_phy_ops, NULL,
-                                    &phy->i2c_dev->dev);
+                                    &phy->i2c_dev->dev,
+                                    &client->dev);
 
        if (IS_ERR(priv)) {
                r = PTR_ERR(priv);
index ee9e8f1195faacf3585c44dac4fd9cc09ccd718c..d82eecd8daadff2c95d4f54eb6d2083c17770999 100644 (file)
@@ -2554,7 +2554,8 @@ struct pn533 *pn533_register_device(u32 device_type,
                                void *phy,
                                struct pn533_phy_ops *phy_ops,
                                struct pn533_frame_ops *fops,
-                               struct device *dev)
+                               struct device *dev,
+                               struct device *parent)
 {
        struct pn533_fw_version fw_ver;
        struct pn533 *priv;
@@ -2617,6 +2618,7 @@ struct pn533 *pn533_register_device(u32 device_type,
                goto destroy_wq;
        }
 
+       nfc_set_parent_dev(priv->nfc_dev, parent);
        nfc_set_drvdata(priv->nfc_dev, priv);
 
        rc = nfc_register_device(priv->nfc_dev);
index ba604f6d93f94dcc08137bae3fdde99f77bb0417..553c7d171fd1112b6c4906b566aa66a760bb81dc 100644 (file)
@@ -228,7 +228,8 @@ struct pn533 *pn533_register_device(u32 device_type,
                                void *phy,
                                struct pn533_phy_ops *phy_ops,
                                struct pn533_frame_ops *fops,
-                               struct device *dev);
+                               struct device *dev,
+                               struct device *parent);
 
 void pn533_unregister_device(struct pn533 *priv);
 void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status);
index 4f73cbf8cceffc36cdafbb36377041ca61b9138b..8ca060324b6aa9ef9a200e5b26b249f3e7e4003d 100644 (file)
@@ -536,7 +536,7 @@ static int pn533_usb_probe(struct usb_interface *interface,
 
        priv = pn533_register_device(id->driver_info, protocols, protocol_type,
                                        phy, &usb_phy_ops, fops,
-                                       &phy->udev->dev);
+                                       &phy->udev->dev, &interface->dev);
 
        if (IS_ERR(priv)) {
                rc = PTR_ERR(priv);
@@ -544,7 +544,6 @@ static int pn533_usb_probe(struct usb_interface *interface,
        }
 
        phy->priv = priv;
-       nfc_set_parent_dev(priv->nfc_dev, &interface->dev);
 
        usb_set_intfdata(interface, phy);
 
This page took 0.029282 seconds and 5 git commands to generate.