2010-07-05 08:01:40

by Kulikov Vasiliy

[permalink] [raw]
Subject: [PATCH] bluetooth: btmrvl_sdio: silence warning

Clone checking of ret to simplify the code.

This patch silences a compiler warning:
drivers/bluetooth/btmrvl_sdio.c: In function ‘btmrvl_sdio_verify_fw_download’:
drivers/bluetooth/btmrvl_sdio.c:80: warning: ‘fws1’ may be used uninitialized in this function
drivers/bluetooth/btmrvl_sdio.c:80: note: ‘fws1’ was declared here

Signed-off-by: Kulikov Vasiliy <[email protected]>
---
drivers/bluetooth/btmrvl_sdio.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index df0773e..47f0f91 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -83,10 +83,10 @@ static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat)
*dat = 0;

fws0 = sdio_readb(card->func, CARD_FW_STATUS0_REG, &ret);
+ if (ret)
+ return -EIO;

- if (!ret)
- fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret);
-
+ fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret);
if (ret)
return -EIO;

--
1.7.0.4


2010-07-05 09:26:28

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] bluetooth: btmrvl_sdio: silence warning

On Mon, Jul 05, 2010 at 12:01:22PM +0400, Kulikov Vasiliy wrote:
> Clone checking of ret to simplify the code.
>
> This patch silences a compiler warning:
> drivers/bluetooth/btmrvl_sdio.c: In function ‘btmrvl_sdio_verify_fw_download’:
> drivers/bluetooth/btmrvl_sdio.c:80: warning: ‘fws1’ may be used uninitialized in this function
> drivers/bluetooth/btmrvl_sdio.c:80: note: ‘fws1’ was declared here
>
> Signed-off-by: Kulikov Vasiliy <[email protected]>
> ---
> drivers/bluetooth/btmrvl_sdio.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
> index df0773e..47f0f91 100644
> --- a/drivers/bluetooth/btmrvl_sdio.c
> +++ b/drivers/bluetooth/btmrvl_sdio.c
> @@ -83,10 +83,10 @@ static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat)
> *dat = 0;
>
> fws0 = sdio_readb(card->func, CARD_FW_STATUS0_REG, &ret);
> + if (ret)
> + return -EIO;

Normally it would be better to just "return ret;" here. But the caller
doesn't use the return code so it doesn't really matter...

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter

>
> - if (!ret)
> - fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret);
> -
> + fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret);
> if (ret)
> return -EIO;
>

2010-07-08 21:03:08

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] bluetooth: btmrvl_sdio: silence warning

Hi Kulikov,

> Clone checking of ret to simplify the code.
>
> This patch silences a compiler warning:
> drivers/bluetooth/btmrvl_sdio.c: In function ‘btmrvl_sdio_verify_fw_download’:
> drivers/bluetooth/btmrvl_sdio.c:80: warning: ‘fws1’ may be used uninitialized in this function
> drivers/bluetooth/btmrvl_sdio.c:80: note: ‘fws1’ was declared here
>
> Signed-off-by: Kulikov Vasiliy <[email protected]>

patch has been applied to bluetooth-next-2.6 tree. Thanks.

Regards

Marcel