Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp81004ybm; Tue, 26 May 2020 11:16:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt1+VHO0oJXnwH6u9reaKVGtt91e5qB8zVpbQHBFYO6T1E24HdzW21kiziQ4Z+6Ieoqp3N X-Received: by 2002:aa7:d44a:: with SMTP id q10mr21747847edr.386.1590516963219; Tue, 26 May 2020 11:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590516963; cv=none; d=google.com; s=arc-20160816; b=vpYooInPAZxy6SF8WN/dBO95y1vfwOqP7qYfK9A+3w/85wEeC0RzFNx+shl/VceBOB Q94Y6mhDh6CIS1t4gnqy8vnSCJF0z8Sjc7F8fgUEHjmebrWsBNa8oSp//ZU72JJuHHDN pHZCofzNqM1/VT7vq7gKWpugoNvBS4YHPxhPjUFhUO7DskQ91ZnVgfLSr8s8P8enJqmK SioNCphY9bVlM7FgNpDj5BfpvVHicOi7CJx8bbn/xEgl1uq/Bixw1DSqfLHd7XgwGXjV 3mYWaV+WE7zkL+yq9jemn3FFwXnx0ajPlchMjT1TQmNYzYrzyJ1T4s2K69C5NwnrpaYJ qugA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1M5+lH45bn+qZSHAItaOoLPP98v+wT4Co9b5U7SWVW8=; b=PQBjzoQrWx+F9hAiECOwyXG2zB+GfsmDIFuSOL6YANR96mcvAHX6zQ+jyNH7Pip+/M q31umyU9GfNfaXvOXD7q/ioeP3giHM1n6HHxcA3/Am1oZQferuLMdiDvXAA3vjzASYnw y0hcbhs5cE5KohOPQeYQMLIJxLiZH7i06OC3EogQOqNSZ17NOrkz2Na9laqQiBAPC0VZ 143AZb3k9It2ZQRPwckVfjuD4PmZWND5jafacZMcWi8EQJmvgxvJTJrEJcTzVXaHdl/n 6sPRNZFw7sCcXtr/H33AerNSsYr5kCvU1ivW+KixwNuRTparJWEt14/oNxygMxhxlsWU I5Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RaHt12wv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si368539ejk.3.2020.05.26.11.15.40; Tue, 26 May 2020 11:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RaHt12wv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389115AbgEZSNL (ORCPT + 99 others); Tue, 26 May 2020 14:13:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389096AbgEZSNK (ORCPT ); Tue, 26 May 2020 14:13:10 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9D9C03E96D for ; Tue, 26 May 2020 11:13:10 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id t16so8983417plo.7 for ; Tue, 26 May 2020 11:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1M5+lH45bn+qZSHAItaOoLPP98v+wT4Co9b5U7SWVW8=; b=RaHt12wvpTY6tOtLb0vsYNtTEE8M9Nm7372Hem6BcTR/cAOxWvBgWbepKF+wDO6OOC L3qLV61B7B4CQ08v0XAJAVSWUAfbp9wb2Nnd8a3VpYrpmZPuQds2W/QiR/KhovDSfCpR 1jmQxShRSLc9XMnsKLdfUDzjFXPK6YmrpNPWzbxPLyA1KxyAtlStDGCghvauxIc6x8ZE vGsoDOzYTBOwrJKFRy/Sgdes9XFX2bQitPEsE2UcvUce49QHdWVEUZBP5ybPin8Kcq9B XE/9GXrpHUjrTR+CJVn+HVEnBH83BL5If0DRL/kgTJ18N9m1V5bG2vYyDpxLdwXgk1rs M+kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1M5+lH45bn+qZSHAItaOoLPP98v+wT4Co9b5U7SWVW8=; b=An+I2aIsOeaMv8OMccRlvBS1rfcS9oNJqzT1rWJqoXP3OmXr2Q6z9LFlrKKNjwyLPc rAD/GJbRMbEpmHGdlJ5cAd0iPkZCQ2ipvZVHuGlkKg4eg3dAl100zHZVuJ7qiFDq8+p8 vfq23hJFduHPLVgEUIvsCchTYBPJ2oQH5FiNE2kb2CWQPh8d8XQ82TGH7kfCLwrFdc51 K7cB9avc40HQMNmqNw6NGr5dy9t4+d1l5IKmnhBDAps/orB1d6hi+/BQDPKHHIdydqYJ FP44lUSG5haTwLn755tp3f/kdhoBzkWUwGS4O9igMOttAWPyyF2rYwuLQ8OelzBq9uOX H17Q== X-Gm-Message-State: AOAM530B3taQpyWVQjrxFGgYzTFwhwo94c3kEvCI/w30Ov3ZzUKGM7fz OqugpEuB+zeaKwu2eToLWZlYXNAxehGoWSQm0ax2dQ== X-Received: by 2002:a17:902:341:: with SMTP id 59mr2088402pld.119.1590516789291; Tue, 26 May 2020 11:13:09 -0700 (PDT) MIME-Version: 1.0 References: <20200523035043.3305846-1-natechancellor@gmail.com> In-Reply-To: <20200523035043.3305846-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Tue, 26 May 2020 11:12:58 -0700 Message-ID: Subject: Re: [PATCH] phy: intel: Eliminate unnecessary assignment in intel_cbphy_set_mode To: Nathan Chancellor Cc: Kishon Vijay Abraham I , Vinod Koul , LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 8:51 PM Nathan Chancellor wrote: > > Clang warns: > > drivers/phy/intel/phy-intel-combo.c:202:34: warning: implicit conversion > from enumeration type 'enum intel_phy_mode' to different enumeration > type 'enum intel_combo_mode' [-Wenum-conversion] > enum intel_combo_mode cb_mode = PHY_PCIE_MODE; > ~~~~~~~ ^~~~~~~~~~~~~ > 1 warning generated. > > The correct enum to use would be PCIE0_PCIE1_MODE. However, eliminating > this assignment is a little better because the switch statement always Indeed, the switch is exhaustive. Might be a risk if new enumeration values are added to the enum, though. Probably should just initialize it to PCIE0_PCIE1_MODE, then you can simplify the PHY_PCIE_MODE case a little (replace ternary with if+assignment). > assigns a new value to cb_mode, which also takes care of the warning. > > Fixes: ac0a95a3ea78 ("phy: intel: Add driver support for ComboPhy") > Link: https://github.com/ClangBuiltLinux/linux/issues/1034 > Signed-off-by: Nathan Chancellor > --- > drivers/phy/intel/phy-intel-combo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/intel/phy-intel-combo.c b/drivers/phy/intel/phy-intel-combo.c > index c2a35be4cdfb..4bc1276ecf23 100644 > --- a/drivers/phy/intel/phy-intel-combo.c > +++ b/drivers/phy/intel/phy-intel-combo.c > @@ -199,9 +199,9 @@ static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy) > > static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy) > { > - enum intel_combo_mode cb_mode = PHY_PCIE_MODE; > enum aggregated_mode aggr = cbphy->aggr_mode; > struct device *dev = cbphy->dev; > + enum intel_combo_mode cb_mode; > enum intel_phy_mode mode; > int ret; > > > base-commit: c11d28ab4a691736e30b49813fb801847bd44e83 > -- -- Thanks, ~Nick Desaulniers