Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: intel: fix enum type mismatch warning

clang points out that a local variable is initialized with
an enum value of the wrong type:

drivers/phy/intel/phy-intel-combo.c:202:34: error: implicit conversion from enumeration type 'enum intel_phy_mode' to different enumeration type 'enum intel_combo_mode' [-Werror,-Wenum-conversion]
enum intel_combo_mode cb_mode = PHY_PCIE_MODE;
~~~~~~~ ^~~~~~~~~~~~~

>From reading the code, it seems that this was not only the
wrong type, but not even supposed to be a code path that can
happen in practice.

Change the code to have no default phy mode but instead return an
error for invalid input.

Fixes: ac0a95a3ea78 ("phy: intel: Add driver support for ComboPhy")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dilip Kota <eswara.kota@linux.intel.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20200527134518.908624-1-arnd@arndb.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Arnd Bergmann and committed by
Vinod Koul
6153224b 76e242c2

+3 -1
+3 -1
drivers/phy/intel/phy-intel-combo.c
··· 199 199 200 200 static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy) 201 201 { 202 - enum intel_combo_mode cb_mode = PHY_PCIE_MODE; 202 + enum intel_combo_mode cb_mode; 203 203 enum aggregated_mode aggr = cbphy->aggr_mode; 204 204 struct device *dev = cbphy->dev; 205 205 enum intel_phy_mode mode; ··· 224 224 225 225 cb_mode = SATA0_SATA1_MODE; 226 226 break; 227 + default: 228 + return -EINVAL; 227 229 } 228 230 229 231 ret = regmap_write(cbphy->hsiocfg, REG_COMBO_MODE(cbphy->bid), cb_mode);