Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp409413img; Thu, 28 Feb 2019 01:23:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IZtX1RGATTcpo0rCnHAuOxh7FMPQmhI+9PXrfLMp4/sl5pDaSzdxyMh+nWCu5pKSuHKYor1 X-Received: by 2002:a17:902:7614:: with SMTP id k20mr6904946pll.298.1551345821624; Thu, 28 Feb 2019 01:23:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551345821; cv=none; d=google.com; s=arc-20160816; b=FKuOkLNwIeVZqp7wdsHnf10VwIXclmPIH8oD1crYvYxhBP4pQEfseRpzW8kPxzffGM VlpCxwqagCawTNJyyVdVU2DgAQDj2ZLfFJ/r1RRp6vYygUIr4+35LVpYDd7ugSe3z+Rj 4HsLOAFMxiONN/3gEJiZDc/MZnOHRi1WIdE18w529H8+XXTxTMlJGfJODjX9zjeTxGYq nOuO00SynwsVef5i+ZXQiQLREHjCh8Sf7koNYFUftxUJN/Red639SdVPNHhoS+Z1t38N KwbhgfI2ni8EN2H21xRke7aAc0UmX08xnhhO8rX3MY0C4DMbvaSMplJzCchJ7bcltltX M1yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:subject:cc:from:to :in-reply-to; bh=vmVCc9vI8Gl2sW4IJMUpYjTr9R5MXoes10KywQuiXvM=; b=FwL63Uo1RdJDlcsV9+2QPrEnZbag+gwD3WZeuq9O2aZSfuRrb8HJgw30+LUQ3liwzb FO2CfPZfwTYTdKoQR/elmASnRIjzlASyQC6uos/Xcd3uCJu9AAgEtpFJfwvU1JwCdVI6 KN0uMysZKhO/YC8hZpCjaYz+SZMV7z2qiFk03cyWlROVKB8v+76xgR5vtSjqYCeBT9z5 f917GzVq+xGq++YOAhmim8iAMdQhq3oQ5/eR2ltrJh2iyIwrgUdMYnF2nyDCGL9UgplQ loxwXJAQIjSRW0ElOQwjvkJx2Jbi1h0LeG+riKMIxHC21lT8MM1yHlvS2EsnXHuCa8Xy nBFw== 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 r63si18686855plb.303.2019.02.28.01.23.25; Thu, 28 Feb 2019 01:23:41 -0800 (PST) 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 S1731373AbfB1JVN (ORCPT + 99 others); Thu, 28 Feb 2019 04:21:13 -0500 Received: from ozlabs.org ([203.11.71.1]:50535 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731161AbfB1JVN (ORCPT ); Thu, 28 Feb 2019 04:21:13 -0500 Received: by ozlabs.org (Postfix, from userid 1034) id 4496VZ4JGRz9s9L; Thu, 28 Feb 2019 20:21:10 +1100 (AEDT) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: e7140639b1de65bba435a6bd772d134901141f86 X-Patchwork-Hint: ignore In-Reply-To: <20190226053855.7020-1-natechancellor@gmail.com> To: Nathan Chancellor , Benjamin Herrenschmidt , Paul Mackerras From: Michael Ellerman Cc: Nick Desaulniers , Nathan Chancellor , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Joel Stanley Subject: Re: powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc Message-Id: <4496VZ4JGRz9s9L@ozlabs.org> Date: Thu, 28 Feb 2019 20:21:10 +1100 (AEDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-02-26 at 05:38:55 UTC, Nathan Chancellor wrote: > When building with -Wsometimes-uninitialized, Clang warns: > > arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used > uninitialized whenever 'if' condition is false > [-Wsometimes-uninitialized] > if (cpu_has_feature(CPU_FTRS_POWER9)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > arch/powerpc/xmon/ppc-dis.c:167:7: note: uninitialized use occurs here > if (opcode == NULL) > ^~~~~~ > arch/powerpc/xmon/ppc-dis.c:157:3: note: remove the 'if' if its > condition is always true > if (cpu_has_feature(CPU_FTRS_POWER9)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > arch/powerpc/xmon/ppc-dis.c:132:38: note: initialize the variable > 'opcode' to silence this warning > const struct powerpc_opcode *opcode; > ^ > = NULL > 1 warning generated. > > This warning seems to make no sense on the surface because opcode is set > to NULL right below this statement. However, there is a comma instead of > semicolon to end the dialect assignment, meaning that the opcode > assignment only happens in the if statement. Properly terminate that > line so that Clang no longer warns. > > Fixes: 5b102782c7f4 ("powerpc/xmon: Enable disassembly files (compilation changes)") > Link: https://github.com/ClangBuiltLinux/linux/issues/390 > Signed-off-by: Nathan Chancellor > Reviewed-by: Nick Desaulniers Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/e7140639b1de65bba435a6bd772d1349 cheers