libata: fix compile warning caused by ignoring __must_check results
PATCH 1/1 libata: fix compile warning caused by ignoring __must_check results
Fix compile warnings in pata_cs5530, sata_inic162x and sata_nv which are caused by throwing away return values marked with __must_check.
--- 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(-)
drivers/ata/libata-sff.c +7 -3
@@ -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 */
drivers/ata/pata_cs5530.c +5 -1
@@ -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:
drivers/ata/sata_inic162x.c +3 -1
@@ -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" );
drivers/ata/sata_nv.c +4 -1
@@ -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 ) {
Signature · 1 line
1.4.4.3
PATCH RESEND 1/1 libata: fix compile warning caused by ignoring __must_check results
* 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).
---
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(-)
drivers/ata/libata-sff.c +7 -3
@@ -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 */
drivers/ata/pata_cs5530.c +5 -1
@@ -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:
drivers/ata/sata_inic162x.c +3 -1
@@ -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" );
drivers/ata/sata_nv.c +4 -1
@@ -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 ) {
Signature · 1 line
1.4.4.3