Skip to content

Commit 6153224

Browse files
arndbvinodkoul
authored andcommitted
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: ac0a95a ("phy: intel: Add driver support for ComboPhy") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Dilip Kota <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 76e242c commit 6153224

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/phy/intel/phy-intel-combo.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int intel_cbphy_pcie_dis_pad_refclk(struct intel_cbphy_iphy *iphy)
199199

200200
static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy)
201201
{
202-
enum intel_combo_mode cb_mode = PHY_PCIE_MODE;
202+
enum intel_combo_mode cb_mode;
203203
enum aggregated_mode aggr = cbphy->aggr_mode;
204204
struct device *dev = cbphy->dev;
205205
enum intel_phy_mode mode;
@@ -224,6 +224,8 @@ static int intel_cbphy_set_mode(struct intel_combo_phy *cbphy)
224224

225225
cb_mode = SATA0_SATA1_MODE;
226226
break;
227+
default:
228+
return -EINVAL;
227229
}
228230

229231
ret = regmap_write(cbphy->hsiocfg, REG_COMBO_MODE(cbphy->bid), cb_mode);

0 commit comments

Comments
 (0)