* [PATCH] libata: fix compile warning caused by ignoring __must_check results
@ 2007-01-20 6:45 Tejun Heo
2007-01-20 6:50 ` [PATCH RESEND] " Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2007-01-20 6:45 UTC (permalink / raw)
To: Jeff Garzik, linux-ide
Fix compile warnings in pata_cs5530, sata_inic162x and sata_nv which
are caused by throwing away return values marked with __must_check.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/ata/libata-sff.c | 10 +++++++---
drivers/ata/pata_cs5530.c | 6 +++++-
drivers/ata/sata_inic162x.c | 4 +++-
drivers/ata/sata_nv.c | 5 ++++-
4 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 69a5910..c7acbe9 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1096,12 +1096,16 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
} else
legacy_mode |= ATA_PORT_SECONDARY;
+ /* For backward-compatibility reasons, we don't care
+ * whether the followings succeed or fail. Throw away
+ * return value explicitly to override __must_check.
+ */
if (legacy_mode & ATA_PORT_PRIMARY)
- pci_request_region(pdev, 1, DRV_NAME);
+ rc = pci_request_region(pdev, 1, DRV_NAME);
if (legacy_mode & ATA_PORT_SECONDARY)
- pci_request_region(pdev, 3, DRV_NAME);
+ rc = pci_request_region(pdev, 3, DRV_NAME);
/* If there is a DMA resource, allocate it */
- pci_request_region(pdev, 4, DRV_NAME);
+ rc = pci_request_region(pdev, 4, DRV_NAME);
}
/* we have legacy mode, but all ports are unavailable */
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 611d90f..d0e542c 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -251,6 +251,7 @@ static int cs5530_is_palmax(void)
static int cs5530_init_chip(void)
{
struct pci_dev *master_0 = NULL, *cs5530_0 = NULL, *dev = NULL;
+ int rc;
while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) {
switch (dev->device) {
@@ -272,7 +273,10 @@ static int cs5530_init_chip(void)
}
pci_set_master(cs5530_0);
- pci_set_mwi(cs5530_0);
+ rc = pci_set_mwi(cs5530_0);
+ if (rc)
+ dev_printk(KERN_WARNING, &cs5530_0->dev,
+ "WARNING: failed to set MWI\n");
/*
* Set PCI CacheLineSize to 16-bytes:
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index b67817e..6cd1fe9 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -649,7 +649,9 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
void __iomem *mmio_base = host->mmio_base;
int rc;
- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
printk("XXX\n");
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index cc10e43..9d8db97 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1554,8 +1554,11 @@ static int nv_pci_device_resume(struct pci_dev *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
struct nv_host_priv *hpriv = host->private_data;
+ int rc;
- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
if(hpriv->type >= CK804) {
--
1.4.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND] libata: fix compile warning caused by ignoring __must_check results
2007-01-20 6:45 [PATCH] libata: fix compile warning caused by ignoring __must_check results Tejun Heo
@ 2007-01-20 6:50 ` Tejun Heo
0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2007-01-20 6:50 UTC (permalink / raw)
To: Jeff Garzik, linux-ide
* Fix compile warnings in pata_cs5530, sata_inic162x and sata_nv which
are caused by throwing away return values marked with __must_check.
* pci_request_region() is marked with __must_check.
ata_pci_init_one() didn't check return value for legacy devices
triggering warning message. This patch adds dummy assignment to rc
to remove the warnings. Ignoring the return value is intentional.
Acquiring regions for legacy ctl and bmdma areas is recently added
and we don't wanna fail initialization even if it fails (at least
not yet).
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Sorry, forgot to update description after adding sff changes.
Otherwise, the patch is identical.
drivers/ata/libata-sff.c | 10 +++++++---
drivers/ata/pata_cs5530.c | 6 +++++-
drivers/ata/sata_inic162x.c | 4 +++-
drivers/ata/sata_nv.c | 5 ++++-
4 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 69a5910..c7acbe9 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1096,12 +1096,16 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
} else
legacy_mode |= ATA_PORT_SECONDARY;
+ /* For backward-compatibility reasons, we don't care
+ * whether the followings succeed or fail. Throw away
+ * return value explicitly to override __must_check.
+ */
if (legacy_mode & ATA_PORT_PRIMARY)
- pci_request_region(pdev, 1, DRV_NAME);
+ rc = pci_request_region(pdev, 1, DRV_NAME);
if (legacy_mode & ATA_PORT_SECONDARY)
- pci_request_region(pdev, 3, DRV_NAME);
+ rc = pci_request_region(pdev, 3, DRV_NAME);
/* If there is a DMA resource, allocate it */
- pci_request_region(pdev, 4, DRV_NAME);
+ rc = pci_request_region(pdev, 4, DRV_NAME);
}
/* we have legacy mode, but all ports are unavailable */
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 611d90f..d0e542c 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -251,6 +251,7 @@ static int cs5530_is_palmax(void)
static int cs5530_init_chip(void)
{
struct pci_dev *master_0 = NULL, *cs5530_0 = NULL, *dev = NULL;
+ int rc;
while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) {
switch (dev->device) {
@@ -272,7 +273,10 @@ static int cs5530_init_chip(void)
}
pci_set_master(cs5530_0);
- pci_set_mwi(cs5530_0);
+ rc = pci_set_mwi(cs5530_0);
+ if (rc)
+ dev_printk(KERN_WARNING, &cs5530_0->dev,
+ "WARNING: failed to set MWI\n");
/*
* Set PCI CacheLineSize to 16-bytes:
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index b67817e..6cd1fe9 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -649,7 +649,9 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
void __iomem *mmio_base = host->mmio_base;
int rc;
- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
printk("XXX\n");
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index cc10e43..9d8db97 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1554,8 +1554,11 @@ static int nv_pci_device_resume(struct pci_dev *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
struct nv_host_priv *hpriv = host->private_data;
+ int rc;
- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
if(hpriv->type >= CK804) {
--
1.4.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] libata: fix compile warning caused by ignoring __must_check results
@ 2007-01-20 5:23 Tejun Heo
2007-01-22 11:29 ` Alan
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2007-01-20 5:23 UTC (permalink / raw)
To: Jeff Garzik, linux-ide
Fix compile warnings in pata_cs5530, sata_inic162x and sata_nv which
are caused by throwing away return values marked with __must_check.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/ata/pata_cs5530.c | 6 +++++-
drivers/ata/sata_inic162x.c | 4 +++-
drivers/ata/sata_nv.c | 5 ++++-
3 files changed, 12 insertions(+), 3 deletions(-)
Index: work/drivers/ata/pata_cs5530.c
===================================================================
--- work.orig/drivers/ata/pata_cs5530.c
+++ work/drivers/ata/pata_cs5530.c
@@ -251,6 +251,7 @@ static int cs5530_is_palmax(void)
static int cs5530_init_chip(void)
{
struct pci_dev *master_0 = NULL, *cs5530_0 = NULL, *dev = NULL;
+ int rc;
while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) {
switch (dev->device) {
@@ -272,7 +273,10 @@ static int cs5530_init_chip(void)
}
pci_set_master(cs5530_0);
- pci_set_mwi(cs5530_0);
+ rc = pci_set_mwi(cs5530_0);
+ if (rc)
+ dev_printk(KERN_WARNING, &cs5530_0->dev,
+ "WARNING: failed to set MWI\n");
/*
* Set PCI CacheLineSize to 16-bytes:
Index: work/drivers/ata/sata_inic162x.c
===================================================================
--- work.orig/drivers/ata/sata_inic162x.c
+++ work/drivers/ata/sata_inic162x.c
@@ -649,7 +649,9 @@ static int inic_pci_device_resume(struct
void __iomem *mmio_base = host->mmio_base;
int rc;
- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
printk("XXX\n");
Index: work/drivers/ata/sata_nv.c
===================================================================
--- work.orig/drivers/ata/sata_nv.c
+++ work/drivers/ata/sata_nv.c
@@ -1554,8 +1554,11 @@ static int nv_pci_device_resume(struct p
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
struct nv_host_priv *hpriv = host->private_data;
+ int rc;
- ata_pci_device_do_resume(pdev);
+ rc = ata_pci_device_do_resume(pdev);
+ if (rc)
+ return rc;
if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
if(hpriv->type >= CK804) {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libata: fix compile warning caused by ignoring __must_check results
2007-01-20 5:23 [PATCH] " Tejun Heo
@ 2007-01-22 11:29 ` Alan
2007-01-22 17:07 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Alan @ 2007-01-22 11:29 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, linux-ide
On Sat, 20 Jan 2007 14:23:29 +0900
Tejun Heo <htejun@gmail.com> wrote:
> Fix compile warnings in pata_cs5530, sata_inic162x and sata_nv which
> are caused by throwing away return values marked with __must_check.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
NAK NAK NAK NAK NAK NAK
As was previously discussed the bug is the bogus __must_check on
pci_set_mwi. That __must_check should be removed and that was also the
decision before but nothing happened. Please therefore get the pci header
fixed.
> pci_set_master(cs5530_0);
> - pci_set_mwi(cs5530_0);
> + rc = pci_set_mwi(cs5530_0);
> + if (rc)
> + dev_printk(KERN_WARNING, &cs5530_0->dev,
> + "WARNING: failed to set MWI\n");
Please drop this patch. Users don't need to scared by this bogus message.
Alan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libata: fix compile warning caused by ignoring __must_check results
2007-01-22 11:29 ` Alan
@ 2007-01-22 17:07 ` Tejun Heo
0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2007-01-22 17:07 UTC (permalink / raw)
To: Alan; +Cc: Jeff Garzik, linux-ide
Alan wrote:
> On Sat, 20 Jan 2007 14:23:29 +0900
> Tejun Heo <htejun@gmail.com> wrote:
>
>> Fix compile warnings in pata_cs5530, sata_inic162x and sata_nv which
>> are caused by throwing away return values marked with __must_check.
>>
>> Signed-off-by: Tejun Heo <htejun@gmail.com>
>
> NAK NAK NAK NAK NAK NAK
>
> As was previously discussed the bug is the bogus __must_check on
> pci_set_mwi. That __must_check should be removed and that was also the
> decision before but nothing happened. Please therefore get the pci header
> fixed.
That works for me too. I'll drop pci_set_mwi() part.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-01-22 17:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-20 6:45 [PATCH] libata: fix compile warning caused by ignoring __must_check results Tejun Heo
2007-01-20 6:50 ` [PATCH RESEND] " Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2007-01-20 5:23 [PATCH] " Tejun Heo
2007-01-22 11:29 ` Alan
2007-01-22 17:07 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.