From: Stephen Boyd Date: Tue, 30 Aug 2022 22:58:30 +0000 (-0700) Subject: platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=dc22a33e35859835b09cff11f445928af0197808;p=linux.git platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Use the standard error pointer macro to shorten the code and simplify. Cc: Prashant Malani Cc: Tzung-Bi Shih Signed-off-by: Stephen Boyd Acked-by: Prashant Malani Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220830225831.2362403-4-swboyd@chromium.org --- diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 3381d842c307b..09ad0d268f4bb 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -185,10 +185,8 @@ static int cros_typec_register_mode_switch(struct cros_typec_port *port, }; port->mode_switch = typec_mux_register(port->sdata->dev, &mode_switch_desc); - if (IS_ERR(port->mode_switch)) - return PTR_ERR(port->mode_switch); - return 0; + return PTR_ERR_OR_ZERO(port->mode_switch); } static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwnode_handle *fwnode) @@ -201,10 +199,8 @@ static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwno }; port->retimer = typec_retimer_register(port->sdata->dev, &retimer_desc); - if (IS_ERR(port->retimer)) - return PTR_ERR(port->retimer); - return 0; + return PTR_ERR_OR_ZERO(port->retimer); } static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)