From patchwork Thu Apr 4 13:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 1077272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44ZjmZ72Djz9sRV for ; Fri, 5 Apr 2019 00:03:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729759AbfDDNDJ (ORCPT ); Thu, 4 Apr 2019 09:03:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49862 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbfDDNDJ (ORCPT ); Thu, 4 Apr 2019 09:03:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C4E62CD7EE; Thu, 4 Apr 2019 13:03:09 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-117-19.ams2.redhat.com [10.36.117.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 506655D9CA; Thu, 4 Apr 2019 13:03:08 +0000 (UTC) From: Hans de Goede To: Wolfram Sang Cc: Hans de Goede , linux-i2c@vger.kernel.org Subject: [PATCH] i2c: core: Fix compiler warning in i2c_generic_scl_recovery Date: Thu, 4 Apr 2019 15:03:06 +0200 Message-Id: <20190404130306.13896-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 04 Apr 2019 13:03:09 +0000 (UTC) Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The compiler is not smart enough to figure out that ret will always be assiged a value in the while loop. Explicitly init ret, fixing: drivers/i2c/i2c-core-base.c: In function ‘i2c_generic_scl_recovery’: drivers/i2c/i2c-core-base.c:235:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized] 235 | if (ret == -EOPNOTSUPP) | ^ Signed-off-by: Hans de Goede --- drivers/i2c/i2c-core-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 38af18645133..c480ca385ffb 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -185,7 +185,7 @@ static int i2c_generic_bus_free(struct i2c_adapter *adap) int i2c_generic_scl_recovery(struct i2c_adapter *adap) { struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; - int i = 0, scl = 1, ret; + int i = 0, scl = 1, ret = 0; if (bri->prepare_recovery) bri->prepare_recovery(adap);