diff options
Diffstat (limited to 'drivers/usb/host/ssb-hcd.c')
-rw-r--r-- | drivers/usb/host/ssb-hcd.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/usb/host/ssb-hcd.c b/drivers/usb/host/ssb-hcd.c index ffc32f4b1b1b..62b6b7804c66 100644 --- a/drivers/usb/host/ssb-hcd.c +++ b/drivers/usb/host/ssb-hcd.c | |||
@@ -105,7 +105,7 @@ static struct platform_device *ssb_hcd_create_pdev(struct ssb_device *dev, bool | |||
105 | { | 105 | { |
106 | struct platform_device *hci_dev; | 106 | struct platform_device *hci_dev; |
107 | struct resource hci_res[2]; | 107 | struct resource hci_res[2]; |
108 | int ret = -ENOMEM; | 108 | int ret; |
109 | 109 | ||
110 | memset(hci_res, 0, sizeof(hci_res)); | 110 | memset(hci_res, 0, sizeof(hci_res)); |
111 | 111 | ||
@@ -119,7 +119,7 @@ static struct platform_device *ssb_hcd_create_pdev(struct ssb_device *dev, bool | |||
119 | hci_dev = platform_device_alloc(ohci ? "ohci-platform" : | 119 | hci_dev = platform_device_alloc(ohci ? "ohci-platform" : |
120 | "ehci-platform" , 0); | 120 | "ehci-platform" , 0); |
121 | if (!hci_dev) | 121 | if (!hci_dev) |
122 | return NULL; | 122 | return ERR_PTR(-ENOMEM); |
123 | 123 | ||
124 | hci_dev->dev.parent = dev->dev; | 124 | hci_dev->dev.parent = dev->dev; |
125 | hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; | 125 | hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; |
@@ -166,7 +166,8 @@ static int ssb_hcd_probe(struct ssb_device *dev, | |||
166 | if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) | 166 | if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) |
167 | return -EOPNOTSUPP; | 167 | return -EOPNOTSUPP; |
168 | 168 | ||
169 | usb_dev = kzalloc(sizeof(struct ssb_hcd_device), GFP_KERNEL); | 169 | usb_dev = devm_kzalloc(dev->dev, sizeof(struct ssb_hcd_device), |
170 | GFP_KERNEL); | ||
170 | if (!usb_dev) | 171 | if (!usb_dev) |
171 | return -ENOMEM; | 172 | return -ENOMEM; |
172 | 173 | ||
@@ -181,10 +182,8 @@ static int ssb_hcd_probe(struct ssb_device *dev, | |||
181 | start = ssb_admatch_base(tmp); | 182 | start = ssb_admatch_base(tmp); |
182 | len = (coreid == SSB_DEV_USB20_HOST) ? 0x800 : ssb_admatch_size(tmp); | 183 | len = (coreid == SSB_DEV_USB20_HOST) ? 0x800 : ssb_admatch_size(tmp); |
183 | usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, true, start, len); | 184 | usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, true, start, len); |
184 | if (IS_ERR(usb_dev->ohci_dev)) { | 185 | if (IS_ERR(usb_dev->ohci_dev)) |
185 | err = PTR_ERR(usb_dev->ohci_dev); | 186 | return PTR_ERR(usb_dev->ohci_dev); |
186 | goto err_free_usb_dev; | ||
187 | } | ||
188 | 187 | ||
189 | if (coreid == SSB_DEV_USB20_HOST) { | 188 | if (coreid == SSB_DEV_USB20_HOST) { |
190 | start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */ | 189 | start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */ |
@@ -200,8 +199,6 @@ static int ssb_hcd_probe(struct ssb_device *dev, | |||
200 | 199 | ||
201 | err_unregister_ohci_dev: | 200 | err_unregister_ohci_dev: |
202 | platform_device_unregister(usb_dev->ohci_dev); | 201 | platform_device_unregister(usb_dev->ohci_dev); |
203 | err_free_usb_dev: | ||
204 | kfree(usb_dev); | ||
205 | return err; | 202 | return err; |
206 | } | 203 | } |
207 | 204 | ||