Skip to content

Commit d2afb3a

Browse files
Daniel WalkerJames Bottomley
authored andcommitted
[SCSI] BusLogic gcc 4.1 warning fixes
- Reworked all the very long lines in that block (this drivers full of them though) - Returns an error in three places that it didn't before. - Properly clean up after a scsi_add_host() failure. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 4041b9c commit d2afb3a

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

drivers/scsi/BusLogic.c

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,7 @@ static int __init BusLogic_init(void)
21762176
{
21772177
int BusLogicHostAdapterCount = 0, DriverOptionsIndex = 0, ProbeIndex;
21782178
struct BusLogic_HostAdapter *PrototypeHostAdapter;
2179+
int ret = 0;
21792180

21802181
#ifdef MODULE
21812182
if (BusLogic)
@@ -2282,25 +2283,49 @@ static int __init BusLogic_init(void)
22822283
perform Target Device Inquiry.
22832284
*/
22842285
if (BusLogic_ReadHostAdapterConfiguration(HostAdapter) &&
2285-
BusLogic_ReportHostAdapterConfiguration(HostAdapter) && BusLogic_AcquireResources(HostAdapter) && BusLogic_CreateInitialCCBs(HostAdapter) && BusLogic_InitializeHostAdapter(HostAdapter) && BusLogic_TargetDeviceInquiry(HostAdapter)) {
2286+
BusLogic_ReportHostAdapterConfiguration(HostAdapter) &&
2287+
BusLogic_AcquireResources(HostAdapter) &&
2288+
BusLogic_CreateInitialCCBs(HostAdapter) &&
2289+
BusLogic_InitializeHostAdapter(HostAdapter) &&
2290+
BusLogic_TargetDeviceInquiry(HostAdapter)) {
22862291
/*
22872292
Initialization has been completed successfully. Release and
22882293
re-register usage of the I/O Address range so that the Model
22892294
Name of the Host Adapter will appear, and initialize the SCSI
22902295
Host structure.
22912296
*/
2292-
release_region(HostAdapter->IO_Address, HostAdapter->AddressCount);
2293-
if (!request_region(HostAdapter->IO_Address, HostAdapter->AddressCount, HostAdapter->FullModelName)) {
2294-
printk(KERN_WARNING "BusLogic: Release and re-register of " "port 0x%04lx failed \n", (unsigned long) HostAdapter->IO_Address);
2297+
release_region(HostAdapter->IO_Address,
2298+
HostAdapter->AddressCount);
2299+
if (!request_region(HostAdapter->IO_Address,
2300+
HostAdapter->AddressCount,
2301+
HostAdapter->FullModelName)) {
2302+
printk(KERN_WARNING
2303+
"BusLogic: Release and re-register of "
2304+
"port 0x%04lx failed \n",
2305+
(unsigned long)HostAdapter->IO_Address);
22952306
BusLogic_DestroyCCBs(HostAdapter);
22962307
BusLogic_ReleaseResources(HostAdapter);
22972308
list_del(&HostAdapter->host_list);
22982309
scsi_host_put(Host);
2310+
ret = -ENOMEM;
22992311
} else {
2300-
BusLogic_InitializeHostStructure(HostAdapter, Host);
2301-
scsi_add_host(Host, HostAdapter->PCI_Device ? &HostAdapter->PCI_Device->dev : NULL);
2302-
scsi_scan_host(Host);
2303-
BusLogicHostAdapterCount++;
2312+
BusLogic_InitializeHostStructure(HostAdapter,
2313+
Host);
2314+
if (scsi_add_host(Host, HostAdapter->PCI_Device
2315+
? &HostAdapter->PCI_Device->dev
2316+
: NULL)) {
2317+
printk(KERN_WARNING
2318+
"BusLogic: scsi_add_host()"
2319+
"failed!\n");
2320+
BusLogic_DestroyCCBs(HostAdapter);
2321+
BusLogic_ReleaseResources(HostAdapter);
2322+
list_del(&HostAdapter->host_list);
2323+
scsi_host_put(Host);
2324+
ret = -ENODEV;
2325+
} else {
2326+
scsi_scan_host(Host);
2327+
BusLogicHostAdapterCount++;
2328+
}
23042329
}
23052330
} else {
23062331
/*
@@ -2315,12 +2340,13 @@ static int __init BusLogic_init(void)
23152340
BusLogic_ReleaseResources(HostAdapter);
23162341
list_del(&HostAdapter->host_list);
23172342
scsi_host_put(Host);
2343+
ret = -ENODEV;
23182344
}
23192345
}
23202346
kfree(PrototypeHostAdapter);
23212347
kfree(BusLogic_ProbeInfoList);
23222348
BusLogic_ProbeInfoList = NULL;
2323-
return 0;
2349+
return ret;
23242350
}
23252351

23262352

@@ -2954,6 +2980,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
29542980
}
29552981

29562982

2983+
#if 0
29572984
/*
29582985
BusLogic_AbortCommand aborts Command if possible.
29592986
*/
@@ -3024,6 +3051,7 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
30243051
return SUCCESS;
30253052
}
30263053

3054+
#endif
30273055
/*
30283056
BusLogic_ResetHostAdapter resets Host Adapter if possible, marking all
30293057
currently executing SCSI Commands as having been Reset.

0 commit comments

Comments
 (0)