Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp402012ybm; Tue, 26 May 2020 21:03:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQp6jTBss+/t3J2hQ4wlWzK0PxOb2qCmEEXX5Mp0znRzt8LafmD7V/Y1uPQx/Zroro5zEC X-Received: by 2002:aa7:cf11:: with SMTP id a17mr23690655edy.172.1590552201175; Tue, 26 May 2020 21:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590552201; cv=none; d=google.com; s=arc-20160816; b=ecO/vlRKdR8XDiEIAR+ndJdiSlbDEJl97TOCL6fC+Tq8d26cnsH7J2iYzVlUkOzIxq 5/KHR3UcEgntDquOAFPPCFf9yvT2sqVBPb6+iliKjlj2SLTjf96n3syBNVSDJT32eqbY gneijvsOqu/suZmbERLtwV9weKsFzz+Iobf1MZLd8mZercNh35jTC66g7XN4/a3UqeWs I+QXgCh91LbWGTDJBcb+G6/q9SLaih9U4plPkeFB/B9yS0jNvGfgXzrJUwiSum6xABzo U1cxE0asWMBdsCTS5QD4Cep64EEjGEix9ZWUsFwrjhGZEAunIDdHHw4tHv75ZOD4mZlI LHkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5I2hn2Gk7YS7ZyJinmSH1ekt14dXnz61kMHW/CzJYGI=; b=VdgQda8xTjntDYJTF7pM/EzXsl31WyLC3f91qNzJV2DWkOdBEWgNMj3EKpVhLGjk8p jWKIJV0/0fS6L3mTB7wkb8kjNq5qGmvq+ATItfX6/MpiTrnLI9cS7NdeH/v5JvFK8Kj5 k2YuiG1RXAQtxUn9E56K2oAnobke/Sq98dXaydACTa0OKkIsOa4UNew33IAauqNb3fp9 BDTa6TzNXtNuqM0j3sg+MUMGx0KP5CGdu2hHE9vkSjiTygtqaz0NIML+AJNqdYFeTR6q UN5m36MxSHUL+m+3OoUCCzOYdviEgavOAu+o2uzpnxuZbhIjeU8/ahkVx9D6Mh9PzGNO 83LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="lgvely/S"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si1159308edp.360.2020.05.26.21.02.58; Tue, 26 May 2020 21:03:21 -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=@gmail.com header.s=20161025 header.b="lgvely/S"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404020AbgEZUw4 (ORCPT + 99 others); Tue, 26 May 2020 16:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404010AbgEZUwz (ORCPT ); Tue, 26 May 2020 16:52:55 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C081C061A0F for ; Tue, 26 May 2020 13:52:55 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id p21so10628302pgm.13 for ; Tue, 26 May 2020 13:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5I2hn2Gk7YS7ZyJinmSH1ekt14dXnz61kMHW/CzJYGI=; b=lgvely/SxEXaS3BMmX1MjOiEviMZbVKq/GONEWEqz6i7dkTjGv4OAlFZlqGZ7Q0+wV 8veoY8oarMh7tEB/5WUFfeiiP4n7VE/BYMQRRCfdVDUW7+o/neqqiq3F6Hf0IzhCzwsf 6FXX8pcmpwJaWyjJg5Qb1zvP7RTxBARiTdaws6QjOMIjeYqdXYWhff778GN0+2wrKowh jZZC/Hl9n12OLhIKO6XcktIML92w7u6VrXad2pWVDmMZbzXZajCPVjkEEKmejaW9AI0y 0eJUp/q9nwBBASnfjJ6Etc95/Stp0SEkwgysQSFcjVP4B+RkodeLtgQZNN3ieRdBNHy/ y1uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5I2hn2Gk7YS7ZyJinmSH1ekt14dXnz61kMHW/CzJYGI=; b=CPTbkkvoMHhHZ8sveoQzCqYKE1l297uxLAd9RPcPY+0/FvHh6DpH8zlASueTC7hgGd fvQaZd0wunCRUXXn+O7r7sVrle5jXjPLZbFfiBjp0XQRMPHzXKcF0jp0eDuOWYfUyLxj dsOZU8zPBUjDtDDrY+6dxhcicueQuKC3aJvtZq4lafSAvttouVlFoBXa78NFqszzfaPA 776c0Ut9MXrmYFHoH4mIiwfVJE0UH8B0OSjyCeUJ3RUVpyKS36Px1Ik3mGhvTIKxfoFw 8zb9WwaFquoRPiokSI6dRbqLI8uGPzhUv6EgT1zxVF+o39+6M4OV2l3ETriXA3UpsJtU tvWA== X-Gm-Message-State: AOAM5312f2q3BptRnzkRa1Yhz7zewVrpweOImM3IaYNagBbHcq6EQkVP dvM+JijqBMgGlUIP3T+m+3ZmZbM1 X-Received: by 2002:a63:9556:: with SMTP id t22mr632025pgn.83.1590526374755; Tue, 26 May 2020 13:52:54 -0700 (PDT) Received: from ubuntu-s3-xlarge-x86 ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id y4sm375056pfq.10.2020.05.26.13.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 13:52:54 -0700 (PDT) Date: Tue, 26 May 2020 13:52:52 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Kishon Vijay Abraham I , Vinod Koul , LKML , clang-built-linux Subject: Re: [PATCH] phy: intel: Eliminate unnecessary assignment in intel_cbphy_set_mode Message-ID: <20200526205252.GA2607849@ubuntu-s3-xlarge-x86> References: <20200523035043.3305846-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 26, 2020 at 11:12:58AM -0700, Nick Desaulniers wrote: > 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. Clang will warn about that (and since there is no default case statement, that would point to a bug). > 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). I did consider this but every maintainer has their preference around initializing local variables at the top versus close to their usage... I do not really have a preference for what happens here, I'm happy to rework the patch based on maintainer feedback, thanks for the review! Cheers, Nathan > > 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