From: Zijun Hu <zijun.hu@oss.qualcomm.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Zijun Hu <zijun_hu@icloud.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
Zijun Hu <zijun.hu@oss.qualcomm.com>
Subject: [PATCH bluez 2/2] obexd/bluetooth: Clean up redundant code
Date: Tue, 27 Oct 2026 23:45:51 -0700 [thread overview]
Message-ID: <20261027-fix_obex-v1-2-3d91aed181b6@oss.qualcomm.com> (raw)
In-Reply-To: <20261027-fix_obex-v1-0-3d91aed181b6@oss.qualcomm.com>
register_profile() already frees profile->path and sets it to NULL when
it fails, so the same cleanup in name_acquired() does nothing, and the
error message always prints a NULL path. Drop the cleanup and print the
profile UUID instead.
Also drop the trailing return in void functions.
Assisted-by: Claude:claude-sonnet-5-5
---
obexd/plugins/bluetooth.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index b70090971119..0aeb1becdf32 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -88,17 +88,16 @@ done:
if (obex_server_new_connection(server, io, omtu, imtu, stream) < 0)
g_io_channel_shutdown(io, TRUE, NULL);
return;
drop:
error("%s", err->message);
g_io_channel_shutdown(io, TRUE, NULL);
- return;
}
static DBusMessage *invalid_args(DBusMessage *msg)
{
return g_dbus_create_error(msg, "org.bluez.Error.InvalidArguments",
"Invalid arguments in method call");
}
@@ -324,22 +323,19 @@ static void name_acquired(DBusConnection *conn, void *user_data)
bluez_available = TRUE;
for (l = profiles; l; l = l->next) {
struct bluetooth_profile *profile = l->data;
if (profile->path != NULL)
continue;
- if (register_profile(profile) < 0) {
- error("bluetooth: Failed to register profile %s",
- profile->path);
- g_free(profile->path);
- profile->path = NULL;
- }
+ if (register_profile(profile) < 0)
+ error("bluetooth: Failed to register profile UUID %s",
+ profile->uuid);
}
}
static void name_released(DBusConnection *conn, void *user_data)
{
GSList *l;
DBG("org.bluez disappeared");
@@ -479,14 +475,15 @@ static void bluetooth_exit_cb(gboolean at_unregister)
obex_transport_driver_unregister(&driver);
}
static int bluetooth_init(void)
{
return logind_register(bluetooth_init_cb, bluetooth_exit_cb);
}
+
static void bluetooth_exit(void)
{
- return logind_unregister(bluetooth_init_cb, bluetooth_exit_cb);
+ logind_unregister(bluetooth_init_cb, bluetooth_exit_cb);
}
OBEX_PLUGIN_DEFINE(bluetooth, bluetooth_init, bluetooth_exit)
--
2.34.1
prev parent reply other threads:[~2026-10-28 6:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 6:45 [PATCH bluez 0/2] obexd/bluetooth: Fix profile registration race and clean up Zijun Hu
2026-10-28 6:45 ` [PATCH bluez 1/2] obexd/bluetooth: Register profiles added after org.bluez appeared Zijun Hu
2026-10-28 7:48 ` Zijun Hu
2026-10-28 6:45 ` Zijun Hu [this message]
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=20261027-fix_obex-v1-2-3d91aed181b6@oss.qualcomm.com \
--to=zijun.hu@oss.qualcomm.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=zijun_hu@icloud.com \
/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®