From patchwork Wed Jun 21 21:49:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 106124 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2148215qgd; Wed, 21 Jun 2017 14:50:34 -0700 (PDT) X-Received: by 10.84.133.162 with SMTP id f31mr43351137plf.83.1498081833993; Wed, 21 Jun 2017 14:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498081833; cv=none; d=google.com; s=arc-20160816; b=iSiyMmHYwr+fHBdmWQjNwfrCwRaZUB5g+1GwJXZRb9rLPTnRpW8w2kC6FR2suXyVqD O92poPlPGrc1WLSQS1HxmrFAAAAhbNdpSa8USqCc1yg/WVyOTgEU3f4JLyJYLKsHdkqa YQCzxDNVm0izqPCDSMt2oxv4YgDTkFyPkjKjjFxlUGknXZtPRLr+JG4Go1a321l/L52i IiFL4evg1nXqgenbjy1Hob6OyYadbSy5NLKiYnJQvmW5Bqpmy9Wnkv3N3VaCsGbaGLMN FWeuDSiwREdSngYPeXuOMH//eNwafLy9qApH7qx/MK0mKlUwI6baDY3p8DxOCkN5+Ax4 CIDA== 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=w8yJyycd/Hbo0xywf24z8cnB7eEw5pDcLT95X0uMqYk=; b=Ih9UiPWLTdjmuuyerDVA9GIiqF4krQjl3JJdOuas/O5x6CzNPEoptQHiG6R9U+waq4 bJVS++zzWU4M78s752aWo47EgzW44x3upYIJnYCbt9fX/nYdUnzSKb/oOfj2nfr3OKM+ MpVMuDw+a+R+EdwMmYciZqZh+XRtOU/blYsavPzlnKMOrKaNymk2KK0FIcoZaSwzloXJ b5tlmnUt0AiL1ZadthrEYfvEqxlZaX5X0cGnghbU5C+L41eudbzj7a8Hz8d2fPuQixoJ NjLwa2ABgc5tXQZDnYyqbVXgEZTawJFuznUIhtMGUiS1WcUwuojEORwcFQXNkKpVR6m2 548A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 s4si13854904pfi.251.2017.06.21.14.50.33; Wed, 21 Jun 2017 14:50:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752288AbdFUVuZ (ORCPT + 25 others); Wed, 21 Jun 2017 17:50:25 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:60938 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752026AbdFUVuP (ORCPT ); Wed, 21 Jun 2017 17:50:15 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MWONS-1dGYGy1SP4-00Xf67; Wed, 21 Jun 2017 23:50:06 +0200 From: Arnd Bergmann To: Daniel Lezcano , Thomas Gleixner Cc: Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] clocksource/drivers: fix uninitialized variable use in timer_of_init Date: Wed, 21 Jun 2017 23:49:54 +0200 Message-Id: <20170621215005.3870011-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:6LUuj0UK9Dn6HnpDDh9qbPJy/p9khTdYt7Mnj5L+0/M7s43MJP5 f4s74N1zBO0h/wqVz16ILgaAmt2fJ41YmXA09ubx+mpQCys/FtG5q3dnRWbe+Td5sOLrR6A FrSVHQ3XdYYYOLQIUzFx0qH4kgOzuBmaoLievtJem2AwMc8m3iecloknFvyBcrdO27A2A/j XtT2KxIGM63qfdyqARSVg== X-UI-Out-Filterresults: notjunk:1; V01:K0:JCt9sgT5Jhc=:oox6MZ8pUeGzHMriKgDoW6 zCdcqOBkb81RJgyYFp6vloEbx1jyUo2ivmSIlldtPA42peYzIxILX8WP9JrEZmBs0t0A7I7Oz iLI4p1mDVj7tVM36tvtZdGgkbEwQD8jAGyFmRh1s+0sufZTaGL/qeRjRY2cKE+WlG0/tbWbgE RUYP7m73sJw3cV2jX1VlPht0/BoVwk5zWzB+LIXwqNXYLG9AkxQYD8IAD3Cyv+yVgzTy7A7qd w1qb0OcIspkXmCjzr8XyNS2fcMY8LCTOebBJ3H2V4TO51SacT/hzT0QugApKcIbBSepWCQ8Kn Mct8+t/lLcB5YGrcatDWqbv9D0NGTakI49QqEuCOYkb8NXB7Bo7MoOa/O+260zau9YsVMxPJ3 L0txYt15Ni8HNCrF7MS64PQtGEWLj3SqbEpIxwBaaUbG56y+65dDN10ViudSBdQ8PA8s+YbOS MX3lXT9sUwCuhffX0XkPpdTsJLQwCb1u1Mp7hD2UAQrqkAaq18EyuoyNQr/ANqiJb1GDbaENa SiBW/n5hWwWpaKLHrjDuYPRiC8kG/7saWFQ6qH63XjFBMnchwp/NWgYsnx7BRHyCOqSPFQjzA snZw3t51qh3FU2FbbzvR3yrLhyd4QUtVeS5HNEKam7hPHpEguT7Z9ra5uxpmO1Fg5CIJwENT5 2NrtZmLfnELlaDoqUBcW5AeT+2WsaCCPajfdwMgIrd+4Im/g7Vlv+k9opTSKts7bbCj4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If none of the flags are set, 'ret' is uninitialized as pointed out by gcc: drivers/clocksource/timer-of.c: In function 'timer_of_init': drivers/clocksource/timer-of.c:160:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] Since calling the function without any of the flags is an error, set the return value to -EINVAL for that case. Fixes: dc11bae78529 ("clocksource/drivers: Add timer-of common init routine") Signed-off-by: Arnd Bergmann --- drivers/clocksource/timer-of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c index be1dbee11c20..af75cbdcfc06 100644 --- a/drivers/clocksource/timer-of.c +++ b/drivers/clocksource/timer-of.c @@ -130,7 +130,7 @@ static __init int timer_base_init(struct device_node *np, int __init timer_of_init(struct device_node *np, struct timer_of *to) { - int ret; + int ret = -EINVAL; int flags = 0; if (to->flags & TIMER_OF_BASE) {