From: Stephen Boyd <swboyd@chromium.org>
To: Prashant Malani <pmalani@chromium.org>,
Benson Leung <bleung@chromium.org>
Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev,
chrome-platform@lists.linux.dev,
Tzung-Bi Shih <tzungbi@kernel.org>
Subject: [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
Date: Tue, 30 Aug 2022 15:58:30 -0700 [thread overview]
Message-ID: <20220830225831.2362403-4-swboyd@chromium.org> (raw)
In-Reply-To: <20220830225831.2362403-1-swboyd@chromium.org>
Use the standard error pointer macro to shorten the code and simplify.
Cc: Prashant Malani <pmalani@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/platform/chrome/cros_typec_switch.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index 3381d842c307..09ad0d268f4b 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)
--
https://chromeos.dev
next prev parent reply other threads:[~2022-08-30 22:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 22:58 [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch Stephen Boyd
2022-08-30 22:58 ` [PATCH 1/4] platform/chrome: cros_typec_switch: Add missing newline on printk Stephen Boyd
2022-08-30 23:04 ` Prashant Malani
2022-08-30 22:58 ` [PATCH 2/4] platform/chrome: cros_typec_switch: Remove impossible condition Stephen Boyd
2022-08-30 23:05 ` Prashant Malani
2022-08-30 22:58 ` Stephen Boyd [this message]
2022-08-30 23:05 ` [PATCH 3/4] platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify Prashant Malani
2022-08-30 22:58 ` [PATCH 4/4] platform/chrome: cros_typec_switch: Inline DRV_NAME Stephen Boyd
2022-08-30 23:06 ` Prashant Malani
2022-09-01 2:20 ` [PATCH 0/4] platform/chrome: Minor cleanups to cros_typec_switch patchwork-bot+chrome-platform
2022-09-08 0:40 ` patchwork-bot+chrome-platform
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830225831.2362403-4-swboyd@chromium.org \
--to=swboyd@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=pmalani@chromium.org \
--cc=tzungbi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox