diff mbox

power_supply: lp8788-charger: initialize boolean 'found'

Message ID 1456577651-5644-1-git-send-email-colin.king@canonical.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Colin King Feb. 27, 2016, 12:54 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The boolean 'found' is not initialized and hence garbage. It should
be initialized as false.

Found with static analysis using CoverityScan

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/power/lp8788-charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kim, Milo Feb. 28, 2016, 11:22 p.m. UTC | #1
On 2/27/2016 9:54 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The boolean 'found' is not initialized and hence garbage. It should
> be initialized as false.
>
> Found with static analysis using CoverityScan
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Milo Kim <milo.kim@ti.com>

Thanks for catching this.

> ---
>   drivers/power/lp8788-charger.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c
> index f5a48fd..7321b72 100644
> --- a/drivers/power/lp8788-charger.c
> +++ b/drivers/power/lp8788-charger.c
> @@ -455,7 +455,7 @@ static void lp8788_charger_event(struct work_struct *work)
>
>   static bool lp8788_find_irq_id(struct lp8788_charger *pchg, int virq, int *id)
>   {
> -	bool found;
> +	bool found = false;
>   	int i;
>
>   	for (i = 0; i < pchg->num_irqs; i++) {
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sebastian Reichel March 3, 2016, 2:19 p.m. UTC | #2
Hi,

On Sat, Feb 27, 2016 at 12:54:11PM +0000, Colin King wrote:
> The boolean 'found' is not initialized and hence garbage. It should
> be initialized as false.
> 
> Found with static analysis using CoverityScan

Thanks, queued.

-- Sebastian
diff mbox

Patch

diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c
index f5a48fd..7321b72 100644
--- a/drivers/power/lp8788-charger.c
+++ b/drivers/power/lp8788-charger.c
@@ -455,7 +455,7 @@  static void lp8788_charger_event(struct work_struct *work)
 
 static bool lp8788_find_irq_id(struct lp8788_charger *pchg, int virq, int *id)
 {
-	bool found;
+	bool found = false;
 	int i;
 
 	for (i = 0; i < pchg->num_irqs; i++) {