Skip to content

Commit

Permalink
tps6598x: clear int mask on probe failure
Browse files Browse the repository at this point in the history
The interrupt mask is enabled before any potential failure points in
the driver, which can leave a failure path where we exit with
interrupts enabled but the device not live. This causes an infinite
stream of interrupts on an Apple M1 Pro laptop on USB-C.

Add a failure label that's used post enabling interrupts, where we
mask them again before returning an error.

Suggested-by: Sven Peter <[email protected]>
Cc: stable <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
axboe authored and gregkh committed Feb 17, 2022
1 parent 243a1dd commit aba2081
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/usb/typec/tipd/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,12 @@ static int tps6598x_probe(struct i2c_client *client)

ret = tps6598x_read32(tps, TPS_REG_STATUS, &status);
if (ret < 0)
return ret;
goto err_clear_mask;
trace_tps6598x_status(status);

ret = tps6598x_read32(tps, TPS_REG_SYSTEM_CONF, &conf);
if (ret < 0)
return ret;
goto err_clear_mask;

/*
* This fwnode has a "compatible" property, but is never populated as a
Expand Down Expand Up @@ -855,7 +855,8 @@ static int tps6598x_probe(struct i2c_client *client)
usb_role_switch_put(tps->role_sw);
err_fwnode_put:
fwnode_handle_put(fwnode);

err_clear_mask:
tps6598x_write64(tps, TPS_REG_INT_MASK1, 0);
return ret;
}

Expand Down

0 comments on commit aba2081

Please sign in to comment.