From: Dan Carpenter <dan.carpenter@linaro.org>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] Bluetooth: hci_conn: clean up some casts
Date: Mon, 17 Jul 2023 13:20:31 +0300 [thread overview]
Message-ID: <5cbde2b4-69b5-4b25-a095-251c8347cb09@kili.mountain> (raw)
The ERR_PTR/PTR_ERR() functions are only for error pointers. They're
not a generic way to cast pointers to int.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
We should really create INT_PTR/PTR_INT() functions. But this is a
cleanup until someone creates those.
net/bluetooth/hci_conn.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index cccc2b8b60a8..aea6fa12d954 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -873,7 +873,7 @@ static void bis_cleanup(struct hci_conn *conn)
static int remove_cig_sync(struct hci_dev *hdev, void *data)
{
- u8 handle = PTR_ERR(data);
+ u8 handle = (unsigned long)data;
return hci_le_remove_cig_sync(hdev, handle);
}
@@ -882,7 +882,7 @@ static int hci_le_remove_cig(struct hci_dev *hdev, u8 handle)
{
bt_dev_dbg(hdev, "handle 0x%2.2x", handle);
- return hci_cmd_sync_queue(hdev, remove_cig_sync, ERR_PTR(handle), NULL);
+ return hci_cmd_sync_queue(hdev, remove_cig_sync, (void *)(unsigned long)handle, NULL);
}
static void find_cis(struct hci_conn *conn, void *data)
@@ -1234,7 +1234,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 status)
static void create_le_conn_complete(struct hci_dev *hdev, void *data, int err)
{
struct hci_conn *conn;
- u16 handle = PTR_ERR(data);
+ u16 handle = (unsigned long)data;
conn = hci_conn_hash_lookup_handle(hdev, handle);
if (!conn)
@@ -1264,7 +1264,7 @@ static void create_le_conn_complete(struct hci_dev *hdev, void *data, int err)
static int hci_connect_le_sync(struct hci_dev *hdev, void *data)
{
struct hci_conn *conn;
- u16 handle = PTR_ERR(data);
+ u16 handle = (unsigned long)data;
conn = hci_conn_hash_lookup_handle(hdev, handle);
if (!conn)
@@ -2854,7 +2854,7 @@ u32 hci_conn_get_phy(struct hci_conn *conn)
static int abort_conn_sync(struct hci_dev *hdev, void *data)
{
struct hci_conn *conn;
- u16 handle = PTR_ERR(data);
+ u16 handle = (unsigned long)data;
conn = hci_conn_hash_lookup_handle(hdev, handle);
if (!conn)
--
2.39.2
next reply other threads:[~2023-07-17 10:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 10:20 Dan Carpenter [this message]
2023-07-18 19:30 ` Luiz Augusto von Dentz
2023-07-19 8:01 ` Dan Carpenter
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=5cbde2b4-69b5-4b25-a095-251c8347cb09@kili.mountain \
--to=dan.carpenter@linaro.org \
--cc=johan.hedberg@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.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
all inboxes | Powered by JetHome®