* [PATCH] audio: Remove not needed NULL pointer checks
@ 2012-06-13 19:53 Szymon Janc
2012-06-29 11:25 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2012-06-13 19:53 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
g_new0 always returns valid pointer and there is no need to check that.
---
audio/a2dp.c | 2 --
audio/avctp.c | 2 --
audio/avdtp.c | 2 --
audio/avrcp.c | 2 --
4 files changed, 8 deletions(-)
diff --git a/audio/a2dp.c b/audio/a2dp.c
index cc8f139..5a560d4 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -1480,8 +1480,6 @@ proceed:
int av_err;
server = g_new0(struct a2dp_server, 1);
- if (!server)
- return -ENOMEM;
av_err = avdtp_init(src, config, &server->version);
if (av_err < 0) {
diff --git a/audio/avctp.c b/audio/avctp.c
index ae3c04e..e3e5275 100644
--- a/audio/avctp.c
+++ b/audio/avctp.c
@@ -823,8 +823,6 @@ int avctp_register(const bdaddr_t *src, gboolean master)
struct avctp_server *server;
server = g_new0(struct avctp_server, 1);
- if (!server)
- return -ENOMEM;
server->io = avctp_server_socket(src, master);
if (!server->io) {
diff --git a/audio/avdtp.c b/audio/avdtp.c
index eb3f213..138cc61 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -3867,8 +3867,6 @@ int avdtp_init(const bdaddr_t *src, GKeyFile *config, uint16_t *version)
proceed:
server = g_new0(struct avdtp_server, 1);
- if (!server)
- return -ENOMEM;
server->version = ver;
diff --git a/audio/avrcp.c b/audio/avrcp.c
index 89ee112..7adf644 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -1285,8 +1285,6 @@ int avrcp_register(DBusConnection *conn, const bdaddr_t *src, GKeyFile *config)
}
server = g_new0(struct avrcp_server, 1);
- if (!server)
- return -ENOMEM;
record = avrcp_tg_record();
if (!record) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-29 11:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-13 19:53 [PATCH] audio: Remove not needed NULL pointer checks Szymon Janc
2012-06-29 11:25 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).