* [PATCH 0/2] fix two bugs in slic_card_init
@ 2014-05-23 4:38 David Matlack
2014-05-23 4:38 ` [PATCH 1/2] staging: slicoss: fix dma memory leak David Matlack
2014-05-23 4:38 ` [PATCH 2/2] staging: slicoss: handle errors from slic_config_get David Matlack
0 siblings, 2 replies; 4+ messages in thread
From: David Matlack @ 2014-05-23 4:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, liodot, charrer, David Matlack
This patchset fixes two bugs in slic_card_init(). They are grouped in
a series because the second patch depends on the first (for a merge
without conflicts). In content, they are completely separate changes.
They just touch a few of the same lines.
David Matlack (2):
staging: slicoss: fix dma memory leak
staging: slicoss: handle errors from slic_config_get
drivers/staging/slicoss/slicoss.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
--
1.9.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] staging: slicoss: fix dma memory leak
2014-05-23 4:38 [PATCH 0/2] fix two bugs in slic_card_init David Matlack
@ 2014-05-23 4:38 ` David Matlack
2014-05-23 4:38 ` [PATCH 2/2] staging: slicoss: handle errors from slic_config_get David Matlack
1 sibling, 0 replies; 4+ messages in thread
From: David Matlack @ 2014-05-23 4:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, liodot, charrer, David Matlack
Fix memory leak in slic_card_init. If the driver fails to poll for an
interrupt after requesting config data from the device the dma memory
is never freed.
Signed-off-by: David Matlack <matlackdavid@gmail.com>
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/7 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.
drivers/staging/slicoss/slicoss.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index e27b88f..5b82455 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3293,6 +3293,9 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
&slic_regs->slic_isp, 0,
&slic_regs->slic_addr_upper,
0, FLUSH);
+ pci_free_consistent(adapter->pcidev,
+ sizeof(struct slic_eeprom),
+ peeprom, phys_config);
return -EINVAL;
}
}
--
1.9.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] staging: slicoss: handle errors from slic_config_get
2014-05-23 4:38 [PATCH 0/2] fix two bugs in slic_card_init David Matlack
2014-05-23 4:38 ` [PATCH 1/2] staging: slicoss: fix dma memory leak David Matlack
@ 2014-05-23 4:38 ` David Matlack
2014-05-23 11:16 ` Greg KH
1 sibling, 1 reply; 4+ messages in thread
From: David Matlack @ 2014-05-23 4:38 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, liodot, charrer, David Matlack
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>
---
drivers/staging/slicoss/slicoss.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 5b82455..9c48cd8 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1140,14 +1140,10 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
adapter->upr_lock.flags);
}
-static void slic_config_get(struct adapter *adapter, u32 config,
- u32 config_h)
+static int slic_config_get(struct adapter *adapter, u32 config, u32 config_h)
{
- int status;
-
- status = slic_upr_request(adapter,
- SLIC_UPR_RCONFIG,
- (u32) config, (u32) config_h, 0, 0);
+ return slic_upr_request(adapter, SLIC_UPR_RCONFIG, config, config_h,
+ 0, 0);
}
/*
@@ -3262,7 +3258,12 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
spin_unlock_irqrestore(&adapter->bit64reglock.lock,
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 (;;) {
if (adapter->pshmem->isr) {
@@ -3293,10 +3294,8 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
&slic_regs->slic_isp, 0,
&slic_regs->slic_addr_upper,
0, FLUSH);
- pci_free_consistent(adapter->pcidev,
- sizeof(struct slic_eeprom),
- peeprom, phys_config);
- return -EINVAL;
+ status = -EINVAL;
+ goto card_init_err;
}
}
}
@@ -3406,6 +3405,11 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
card->reset_in_progress = 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)
--
1.9.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] staging: slicoss: handle errors from slic_config_get
2014-05-23 4:38 ` [PATCH 2/2] staging: slicoss: handle errors from slic_config_get David Matlack
@ 2014-05-23 11:16 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2014-05-23 11:16 UTC (permalink / raw)
To: David Matlack; +Cc: devel, charrer, linux-kernel, liodot
On Thu, May 22, 2014 at 09:38:45PM -0700, David Matlack wrote:
> 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>
> ---
> drivers/staging/slicoss/slicoss.c | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)
It looks like I had already applied patch 1/2 here, but not this one,
odd.
Anyway, I've applied this, and should be synced up with you now. If I
have missed applying anything, please resend.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-23 18:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 4:38 [PATCH 0/2] fix two bugs in slic_card_init David Matlack
2014-05-23 4:38 ` [PATCH 1/2] staging: slicoss: fix dma memory leak David Matlack
2014-05-23 4:38 ` [PATCH 2/2] staging: slicoss: handle errors from slic_config_get David Matlack
2014-05-23 11:16 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox