Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15288ybl; Thu, 30 Jan 2020 16:05:49 -0800 (PST) X-Google-Smtp-Source: APXvYqzUjqz+cLwMXUXMKz0spFyRm3E78KzTpwFO2IxgFi0l/mKuNXGLw3TJWiliML2l69056Keo X-Received: by 2002:a05:6808:1:: with SMTP id u1mr4820723oic.74.1580429149815; Thu, 30 Jan 2020 16:05:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580429149; cv=none; d=google.com; s=arc-20160816; b=zhJ+LdQOElihFqZcvK17BfrcA9yTAFYXMawM0TOyc+fCL35ybiLS7SySKUIDtA4zls +IHyae57iIfebRQz3/+/rQmwsHk8zkNp2VQnkgzSlKseKlA4XWp3Ra+QIT7GEoB/EV6C Kefru9kc6+hCiyero0IUeI6JQATdK9N00aNmBtx6BUICGe302z9uq+Fv2Wq+XgVt7R6X UXbUhR9YjEUgUxrsq3cHocOeuf6jlpYaEVGJ/yTm9PcbofETrecyJRa2fkgWMkMQiECj Ms32RYhpo3BN9Y1Xe3TJ3+5S2GQvXXiTnNOm8VlC+4PaSb+0uqbEgHraOeB7KeOa3xIF lPqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=uvb7UjEoJ5QUo55mMIeV2X7P8y9RLioRyMnghzSVrBk=; b=miqirTGg3DEtOxN9Mqo6FyGN0AfxHo/9cnpGe2pu6ihCLkBezfRGSkmhpudAm3pLdY 5AJCGkKVSt2h9Tx52zEpI0Br9sQMAqC30JoaOrhEyXLcCVp5lLAlm7GsE/DXvxm+BaWk x+AJC7WERLN2Ini+tREnySe5/FXs40H1gE6iL6L5horMsfwc0RZJwIk+Ff36jMtu/CzH u0HHeG7XAQSsACv970bni5fvIswboJD1oaIKwg1dBpQFtQ8MTsbT/inGq4bHttDx5KwM 49AMPuOpaaEi2Xpgw6zPQU1BKeFzk/fV2oA469+xkE5Bali5VcceHTku0ck1/mPcm4RE N8Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=CxlznEqw; 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 z23si3820311oti.34.2020.01.30.16.05.36; Thu, 30 Jan 2020 16:05:49 -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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=CxlznEqw; 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 S1727666AbgAaAC6 (ORCPT + 99 others); Thu, 30 Jan 2020 19:02:58 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35620 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbgAaAC6 (ORCPT ); Thu, 30 Jan 2020 19:02:58 -0500 Received: by mail-wr1-f68.google.com with SMTP id g17so6458294wro.2 for ; Thu, 30 Jan 2020 16:02:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=uvb7UjEoJ5QUo55mMIeV2X7P8y9RLioRyMnghzSVrBk=; b=CxlznEqw9in4pGeFI7tiEkzvUBjjWH4ADeBPph8G4+G9QoHFQIJpjSfkOWvoW8WmES bO53NJg/itV1GXV6G1yDZaoJifzMxdIbQ0wmIZIrxg+0qfokN/yScPANJDpTfiYXHCP0 VfNqWMyA5ZH6AI7fP9FDpdvUrFP1BlPUqjKbnX7z4kOScVC9S2PYgtG0SZdLk1zt4mlZ qbbFtJUU7oesuCNJ1/a/WEQhVtZmiHwYOpaZQyxhOMQQvZPIOyUem+cP6jJRZVfZ7pqa v8E1I660ZqgFJlEUdtNXhUzypivyNkoXWANhh9KC2NBUAXZeuegEtQCG+n3497o2pVyA iIWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=uvb7UjEoJ5QUo55mMIeV2X7P8y9RLioRyMnghzSVrBk=; b=RdNPea8joCxgs4NbbRQmchgj1dLgpu2ESHcBsZ9WMPaQNiq+DAGV2CH3GxJKysJpUn 7gkWF8eNmyLasalU8dlMQ/SFZM4qxocr/TAoz9eNpBAUR5d5qOAKYB94iU9oQTHotleE AYled2CG5RJgopzC9GqrHIpqpHx9nmZk7cSI6J7IsW5XPJz8rXagHuZh/0tK9WOla93v p2UJXibOgu3hxAFby/uDl/JAwQlGj/KirV33Ik0D4GY0QczkuKU0W5ByfOse/b5xswC6 Q9xW1vwDWNLEE5ovCmcDPc8ckvKrkGD0SwHT9Gsfn7x/09H0rsDyw++9q6Y9EIXqz8bx wgXw== X-Gm-Message-State: APjAAAXUWJRhVelwCfQiUeIm/xKb+EoNDFFWRd3pW03LIwzw99dxHH3W URSPmnsYEWVQbqkHU0v6FO0L8w== X-Received: by 2002:a5d:6b03:: with SMTP id v3mr7812645wrw.289.1580428976708; Thu, 30 Jan 2020 16:02:56 -0800 (PST) Received: from localhost (c-71-197-186-152.hsd1.wa.comcast.net. [71.197.186.152]) by smtp.gmail.com with ESMTPSA id g2sm9292932wrw.76.2020.01.30.16.02.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Jan 2020 16:02:56 -0800 (PST) From: Kevin Hilman To: Nathan Chancellor , Niklas Cassel Cc: Andy Gross , Bjorn Andersson , Kevin Hilman , Nishanth Menon , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: Re: [PATCH] power: avs: qcom-cpr: Avoid clang -Wsometimes-uninitialized in cpr_scale In-Reply-To: <20200130014130.51313-1-natechancellor@gmail.com> References: <20200130014130.51313-1-natechancellor@gmail.com> Date: Thu, 30 Jan 2020 16:02:53 -0800 Message-ID: <7hk158xzki.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nathan Chancellor writes: > Clang warns (trimmed for brevity): > > ../drivers/power/avs/qcom-cpr.c:570:13: warning: variable 'reg_mask' is > used uninitialized whenever 'if' condition is false > [-Wsometimes-uninitialized] > > ../drivers/power/avs/qcom-cpr.c:520:13: warning: variable 'new_uV' is > used uninitialized whenever 'if' condition is false > [-Wsometimes-uninitialized] > > Due to the fact that Clang's static analysis happens before any > optimization passes are taken into account, it cannot see that both > branches in the if statement must be taken because dir cannot be > something other than UP or DOWN due to the check at the top of this > function. Change the else if condition to else to fix this false > positive. > > Fixes: bf6910abf548 ("power: avs: Add support for CPR (Core Power Reduction)") > Link: https://github.com/ClangBuiltLinux/linux/issues/840 > Signed-off-by: Nathan Chancellor Acked-by: Kevin Hilman Rafael, feel free to queue directly. Kevin