ieee1394: sbp2: fix sbp2_remove_device for error cases

Bug found by Olaf Hering <olh@suse.de>:
sbp2util_remove_command_orb_pool requires a valid lu->hi pointer.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+7 -7
+7 -7
drivers/ieee1394/sbp2.c
··· 513 return 0; 514 } 515 516 - static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu) 517 { 518 - struct hpsb_host *host = lu->hi->host; 519 struct list_head *lh, *next; 520 struct sbp2_command_info *cmd; 521 unsigned long flags; ··· 922 923 if (!lu) 924 return; 925 - 926 hi = lu->hi; 927 928 if (lu->shost) { 929 scsi_remove_host(lu->shost); 930 scsi_host_put(lu->shost); 931 } 932 flush_scheduled_work(); 933 - sbp2util_remove_command_orb_pool(lu); 934 935 list_del(&lu->lu_list); 936 ··· 972 973 lu->ud->device.driver_data = NULL; 974 975 - if (hi) 976 - module_put(hi->host->driver->owner); 977 - 978 kfree(lu); 979 } 980
··· 513 return 0; 514 } 515 516 + static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu, 517 + struct hpsb_host *host) 518 { 519 struct list_head *lh, *next; 520 struct sbp2_command_info *cmd; 521 unsigned long flags; ··· 922 923 if (!lu) 924 return; 925 hi = lu->hi; 926 + if (!hi) 927 + goto no_hi; 928 929 if (lu->shost) { 930 scsi_remove_host(lu->shost); 931 scsi_host_put(lu->shost); 932 } 933 flush_scheduled_work(); 934 + sbp2util_remove_command_orb_pool(lu, hi->host); 935 936 list_del(&lu->lu_list); 937 ··· 971 972 lu->ud->device.driver_data = NULL; 973 974 + module_put(hi->host->driver->owner); 975 + no_hi: 976 kfree(lu); 977 } 978