From patchwork Mon Dec 4 14:45:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 120555 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4520985qgn; Mon, 4 Dec 2017 06:45:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMY/MGeWfbsNqJrMEVlBy62GTzOBx2fC04AVbMmXsSaV3HThThf/Gb0oTi2shl4Wpwj5Teka X-Received: by 10.101.78.203 with SMTP id w11mr13843555pgq.439.1512398755692; Mon, 04 Dec 2017 06:45:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512398755; cv=none; d=google.com; s=arc-20160816; b=FuANBw+wkHVZUDziibS2pGalz/Ps3rHpJGQbqTNhjh2k4yTc3gM8WutInUmtl/SrtB ILXscbGJWW10i4M4PtVEN/iEwfBmwutMuuceugWSi3sKOtp8LAUsDSpb9Yo+7+3au/KN fM/0FRs48fgwuW8Zc/5AV82bDgSXkhlh0w03PUxYOkG62HVsI9Q5oJOPST19iqYaJzA5 Ogx8Zqk9CYgviT/KOEBXA4U+ylH5DuVuzTdZ2eqT2meOKTNQ62yxgjGw4LRenxA3MKap 7eNcCHrnW6QeojG3SUzofBaY47UKIZM7aGYoDGSA2COJEAtnyc8diOnpMDRfSyrVX3qJ qHzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qSmYxq8vNCDs2483e9BU/hqQiX0OH/leW/AzNotZpvU=; b=TCpFlB4ti/zlO91qmFWNnvBvoQLH5t1r7t46gJNv8G+MHM9aWOFaDR/ZGtTylMKFRT aZBMX4nl8Ln0SK5nsCRxV2BMJ6ralqpngH29wegUv1/ukKKv9CchuZZVNdoAQuJr5AlN 8imyAM6XIxsNlGaT4VM9E/8eO4dhIIBOPBLDNyMVBtFl+QnP7acB/n+w1eeewgKVkjXN rZAZX1xZZzeHkvsdf+0wwy3/HLipvfd4Zg3MkQ9RI8EY2AMIb1+s5aGpNLsMheNbmmSA JTSa83oe/T16s+PC6gHyUXcXUVnRy77+qDR3rHmZTqUGTC6PloBXAffvwZz+q2PHJorc lX0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g23si10369795pfe.50.2017.12.04.06.45.55 for ; Mon, 04 Dec 2017 06:45:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716AbdLDOpz (ORCPT ); Mon, 4 Dec 2017 09:45:55 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:60057 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752529AbdLDOpy (ORCPT ); Mon, 4 Dec 2017 09:45:54 -0500 Received: from wuerfel.lan ([149.172.96.106]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0ML7th-1eLasu2AWf-000HMT; Mon, 04 Dec 2017 15:45:41 +0100 From: Arnd Bergmann To: Jan-Simon Moeller , Richard Purdie , Jacek Anaszewski , Pavel Machek Cc: Arnd Bergmann , Arvind Yadav , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] leds: blinkm: avoid uninitialized data use Date: Mon, 4 Dec 2017 15:45:29 +0100 Message-Id: <20171204144538.304782-1-arnd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/YMtVcH+WZsDulIh40fQ== Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org gcc-8 reports missing error handling in blinkm_detect, when blinkm() fails, tmpargs[] is uninitialized: drivers/leds/leds-blinkm.c: In function 'blinkm_detect': drivers/leds/leds-blinkm.c:555:6: error: 'tmpargs' may be used uninitialized in this function [-Werror=maybe-uninitialized] This adds a missing error checks. Signed-off-by: Arnd Bergmann --- drivers/leds/leds-blinkm.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.9.0 diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c index d03ed6b4176b..851c1920b63c 100644 --- a/drivers/leds/leds-blinkm.c +++ b/drivers/leds/leds-blinkm.c @@ -549,8 +549,12 @@ static int blinkm_detect(struct i2c_client *client, struct i2c_board_info *info) /* make sure the blinkM is balanced (read/writes) */ while (count > 0) { ret = blinkm_write(client, BLM_GET_ADDR, NULL); + if (ret) + return ret; usleep_range(5000, 10000); ret = blinkm_read(client, BLM_GET_ADDR, tmpargs); + if (ret) + return ret; usleep_range(5000, 10000); if (tmpargs[0] == 0x09) count = 0;