aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorJonathan McDowell <noodles@earth.li>2008-11-04 02:51:38 -0500
committerJeff Garzik <jgarzik@redhat.com>2008-11-07 03:33:45 -0500
commit939a9516416ad8ccec27aa05bd19236c550c0c03 (patch)
tree552191a16f56e63407934b064f96c983f5fa14f1 /drivers/net/usb
parentcd17fa7b8f1dd24b23c464ebcb14e7c058e15097 (diff)
[netdrvr] usb/hso: Cleanup rfkill error handling
Yup, this appears to be the problem, thanks. I think &hso_net->net->dev is more intuitive for the error message, so I've used that. I've also added missing line endings on the error messages and set our local rfkill structure element to NULL on failure so we don't try to call rfkill_unregister on driver removal if we failed to register at all. The patch below Works For Me (TM); the device is detected fine, can be removed without problems and connects ok. I'll have a prod at why the rfkill stuff isn't working next, but I believe this cleanup of the error handling is appropriate no matter what the issue with registration is. Signed-Off-By: Jonathan McDowell <noodles@earth.li> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/hso.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 3f49e8382dd8..8e90891f0e42 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2184,19 +2184,20 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
2184 struct usb_interface *interface) 2184 struct usb_interface *interface)
2185{ 2185{
2186 struct hso_net *hso_net = dev2net(hso_dev); 2186 struct hso_net *hso_net = dev2net(hso_dev);
2187 struct device *dev = hso_dev->dev; 2187 struct device *dev = &hso_net->net->dev;
2188 char *rfkn; 2188 char *rfkn;
2189 2189
2190 hso_net->rfkill = rfkill_allocate(&interface_to_usbdev(interface)->dev, 2190 hso_net->rfkill = rfkill_allocate(&interface_to_usbdev(interface)->dev,
2191 RFKILL_TYPE_WWAN); 2191 RFKILL_TYPE_WWAN);
2192 if (!hso_net->rfkill) { 2192 if (!hso_net->rfkill) {
2193 dev_err(dev, "%s - Out of memory", __func__); 2193 dev_err(dev, "%s - Out of memory\n", __func__);
2194 return; 2194 return;
2195 } 2195 }
2196 rfkn = kzalloc(20, GFP_KERNEL); 2196 rfkn = kzalloc(20, GFP_KERNEL);
2197 if (!rfkn) { 2197 if (!rfkn) {
2198 rfkill_free(hso_net->rfkill); 2198 rfkill_free(hso_net->rfkill);
2199 dev_err(dev, "%s - Out of memory", __func__); 2199 hso_net->rfkill = NULL;
2200 dev_err(dev, "%s - Out of memory\n", __func__);
2200 return; 2201 return;
2201 } 2202 }
2202 snprintf(rfkn, 20, "hso-%d", 2203 snprintf(rfkn, 20, "hso-%d",
@@ -2209,7 +2210,8 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
2209 kfree(rfkn); 2210 kfree(rfkn);
2210 hso_net->rfkill->name = NULL; 2211 hso_net->rfkill->name = NULL;
2211 rfkill_free(hso_net->rfkill); 2212 rfkill_free(hso_net->rfkill);
2212 dev_err(dev, "%s - Failed to register rfkill", __func__); 2213 hso_net->rfkill = NULL;
2214 dev_err(dev, "%s - Failed to register rfkill\n", __func__);
2213 return; 2215 return;
2214 } 2216 }
2215} 2217}