staging: slicoss: handle errors from slic_config_get

slic_config_get() can fail. Change the return type from void to
int and handle the error in slic_card_init(). So now, instead of
silently failing (and then timing out waiting for the config data),
the driver will fail loudly at request time.

Signed-off-by: David Matlack <matlackdavid@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
David Matlack 2014-05-22 21:38:45 -07:00 committed by Greg Kroah-Hartman
parent 28277a55fd
commit 47a401a8ae

View File

@ -1133,14 +1133,10 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
adapter->upr_lock.flags); adapter->upr_lock.flags);
} }
static void slic_config_get(struct adapter *adapter, u32 config, static int slic_config_get(struct adapter *adapter, u32 config, u32 config_h)
u32 config_h)
{ {
int status; return slic_upr_request(adapter, SLIC_UPR_RCONFIG, config, config_h,
0, 0);
status = slic_upr_request(adapter,
SLIC_UPR_RCONFIG,
(u32) config, (u32) config_h, 0, 0);
} }
/* /*
@ -2743,7 +2739,12 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
spin_unlock_irqrestore(&adapter->bit64reglock.lock, spin_unlock_irqrestore(&adapter->bit64reglock.lock,
adapter->bit64reglock.flags); adapter->bit64reglock.flags);
slic_config_get(adapter, phys_configl, phys_configh); status = slic_config_get(adapter, phys_configl, phys_configh);
if (status) {
dev_err(&adapter->pcidev->dev,
"Failed to fetch config data from device.\n");
goto card_init_err;
}
for (;;) { for (;;) {
if (adapter->pshmem->isr) { if (adapter->pshmem->isr) {
@ -2774,10 +2775,8 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
&slic_regs->slic_isp, 0, &slic_regs->slic_isp, 0,
&slic_regs->slic_addr_upper, &slic_regs->slic_addr_upper,
0, FLUSH); 0, FLUSH);
pci_free_consistent(adapter->pcidev, status = -EINVAL;
sizeof(struct slic_eeprom), goto card_init_err;
peeprom, phys_config);
return -EINVAL;
} }
} }
} }
@ -2885,6 +2884,11 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
card->reset_in_progress = 0; card->reset_in_progress = 0;
return 0; return 0;
card_init_err:
pci_free_consistent(adapter->pcidev, sizeof(struct slic_eeprom),
peeprom, phys_config);
return status;
} }
static void slic_init_driver(void) static void slic_init_driver(void)