Patchwork [RFC] ata: sata_sil.c check sil_scr_read for failure

login
register
mail settings
Submitter Jaswinder Singh Rajput
Date Sept. 12, 2009, 6:37 p.m.
Message ID <1252780626.3687.20.camel@ht.satnam>
Download mbox | patch
Permalink /patch/33536/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Jaswinder Singh Rajput - Sept. 12, 2009, 6:37 p.m.
[This is untested]

By checking sil_scr_read, we can get rid of this compilation warning:

  CC [M]  drivers/ata/sata_sil.o
drivers/ata/sata_sil.c: In function ‘sil_host_intr’:
drivers/ata/sata_sil.c:442: warning: ‘serror’ may be used uninitialized in this function

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 drivers/ata/sata_sil.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Tejun Heo - Sept. 14, 2009, 9:24 a.m.
Jaswinder Singh Rajput wrote:
> [This is untested]
> 
> By checking sil_scr_read, we can get rid of this compilation warning:
> 
>   CC [M]  drivers/ata/sata_sil.o
> drivers/ata/sata_sil.c: In function ‘sil_host_intr’:
> drivers/ata/sata_sil.c:442: warning: ‘serror’ may be used uninitialized in this function
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
>  drivers/ata/sata_sil.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
> index 3cb69d5..a908031 100644
> --- a/drivers/ata/sata_sil.c
> +++ b/drivers/ata/sata_sil.c
> @@ -445,7 +445,8 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
>  		 * controllers continue to assert IRQ as long as
>  		 * SError bits are pending.  Clear SError immediately.
>  		 */
> -		sil_scr_read(&ap->link, SCR_ERROR, &serror);
> +		if (sil_scr_read(&ap->link, SCR_ERROR, &serror))
> +			return;
>  		sil_scr_write(&ap->link, SCR_ERROR, serror);

Eh.... the driver knows the call wouldn't fail.  I think
uninitialized_var() would be more appropriate here.

Thanks.

Patch

diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 3cb69d5..a908031 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -445,7 +445,8 @@  static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
 		 * controllers continue to assert IRQ as long as
 		 * SError bits are pending.  Clear SError immediately.
 		 */
-		sil_scr_read(&ap->link, SCR_ERROR, &serror);
+		if (sil_scr_read(&ap->link, SCR_ERROR, &serror))
+			return;
 		sil_scr_write(&ap->link, SCR_ERROR, serror);
 
 		/* Sometimes spurious interrupts occur, double check