aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Belisko <marek.belisko@open-nandra.com>2010-12-09 10:13:47 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-09 19:35:13 -0500
commit5fd866fb6401cf6a912e75e1b9c4b906bf42434e (patch)
tree1a5976f6a7a69856e15c4d2b5c6b96603e49706e
parent115884118a65c18af290476e44ca6c76a2c0a694 (diff)
staging: ft1000: Fix proc initialization handling.
Cleaning proc entries when error occures was not handled correctly. So fix and also add proper cleaning. Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_proc.c40
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_usb.h2
2 files changed, 27 insertions, 15 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
index 105846d104ff..dbd4a1ce9f55 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
@@ -193,32 +193,44 @@ static struct notifier_block ft1000_netdev_notifier = {
193}; 193};
194 194
195 195
196void 196int ft1000InitProc(struct net_device *dev)
197ft1000InitProc (struct net_device *dev)
198{ 197{
199 struct ft1000_info *info; 198 struct ft1000_info *info;
200 struct proc_dir_entry *ft1000_proc_file; 199 struct proc_dir_entry *ft1000_proc_file;
201 info = netdev_priv(dev); 200 int ret = 0;
202 201
202 info = netdev_priv(dev);
203 203
204 info->ft1000_proc_dir = proc_mkdir (FT1000_PROC_DIR, FTNET_PROC); 204 info->ft1000_proc_dir = proc_mkdir (FT1000_PROC_DIR, FTNET_PROC);
205 if (info->ft1000_proc_dir == NULL) 205 if (info->ft1000_proc_dir == NULL) {
206 { 206 printk(KERN_WARNING "Unable to create %s dir.\n",
207 remove_proc_entry (FT1000_PROC_DIR, FTNET_PROC); 207 FT1000_PROC_DIR);
208 } 208 ret = -EINVAL;
209 209 goto fail;
210 }
210 211
211 ft1000_proc_file = 212 ft1000_proc_file =
212 create_proc_read_entry (dev->name, 0644, info->ft1000_proc_dir, 213 create_proc_read_entry (dev->name, 0644, info->ft1000_proc_dir,
213 ft1000ReadProc, dev); 214 ft1000ReadProc, dev);
214 if (ft1000_proc_file == NULL) 215 if (ft1000_proc_file == NULL) {
215 { 216 printk(KERN_WARNING "Unable to create /proc entry.\n");
216 remove_proc_entry (info->netdevname, info->ft1000_proc_dir); 217 ret = -EINVAL;
217 } 218 goto fail_entry;
219 }
218 220
219 snprintf (info->netdevname, IFNAMSIZ, "%s", dev->name); 221 snprintf (info->netdevname, IFNAMSIZ, "%s", dev->name);
220 register_netdevice_notifier (&ft1000_netdev_notifier); 222 ret = register_netdevice_notifier(&ft1000_netdev_notifier);
221 return; 223 if (ret)
224 goto fail_notif;
225
226 return 0;
227
228fail_notif:
229 remove_proc_entry(info->netdevname, info->ft1000_proc_dir);
230fail_entry:
231 remove_proc_entry(FT1000_PROC_DIR, FTNET_PROC);
232fail:
233 return ret;
222} 234}
223 235
224void 236void
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
index 045ef30b79a1..4a91469e64ff 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
@@ -594,7 +594,7 @@ struct usb_interface;
594int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf); 594int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf);
595int ft1000_poll(void* dev_id); 595int ft1000_poll(void* dev_id);
596 596
597void ft1000InitProc(struct net_device *dev); 597int ft1000InitProc(struct net_device *dev);
598void ft1000CleanupProc(struct ft1000_info *info); 598void ft1000CleanupProc(struct ft1000_info *info);
599 599
600 600