connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <wagi@monom.org>
To: connman@lists.linux.dev
Cc: Daniel Wagner <wagi@monom.org>
Subject: [PATCH v1 3/3] gsupplicant: Fix error return type
Date: Tue, 12 Oct 2021 09:06:48 +0200	[thread overview]
Message-ID: <20211012070648.28947-4-wagi@monom.org> (raw)
In-Reply-To: <20211012070648.28947-1-wagi@monom.org>

clang complains with:

gsupplicant/supplicant.c:1220:10: error: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Werror,-Wnon-literal-null-conversion]
                return G_SUPPLICANT_MODE_UNKNOWN;
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
gsupplicant/supplicant.c:1228:10: error: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Werror,-Wnon-literal-null-conversion]
                return G_SUPPLICANT_SECURITY_UNKNOWN;
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Return NULL instead of the enum. In both cases the enum is 0, so there
is no change.
---
 gsupplicant/supplicant.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 8316f48ae0bf..470d99eb36b1 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -1217,7 +1217,7 @@ const char *g_supplicant_network_get_path(GSupplicantNetwork *network)
 const char *g_supplicant_network_get_mode(GSupplicantNetwork *network)
 {
 	if (!network)
-		return G_SUPPLICANT_MODE_UNKNOWN;
+		return NULL;
 
 	return mode2string(network->mode);
 }
@@ -1225,7 +1225,7 @@ const char *g_supplicant_network_get_mode(GSupplicantNetwork *network)
 const char *g_supplicant_network_get_security(GSupplicantNetwork *network)
 {
 	if (!network)
-		return G_SUPPLICANT_SECURITY_UNKNOWN;
+		return NULL;
 
 	return security2string(network->security);
 }
-- 
2.33.0


  parent reply	other threads:[~2021-10-12  7:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  7:06 [PATCH v1 0/3] Fixup clang error messages Daniel Wagner
2021-10-12  7:06 ` [PATCH v1 1/3] build: Only enable -Wcast-align for gcc Daniel Wagner
2021-10-12  7:06 ` [PATCH v1 2/3] inet: Remove unused ipv6_addr_advert_mult Daniel Wagner
2021-10-12  7:06 ` Daniel Wagner [this message]
2021-10-15  7:03 ` [PATCH v1 0/3] Fixup clang error messages Daniel Wagner
2021-10-15  8:55 ` VAUTRIN Emmanuel (Canal Plus Prestataire)
2021-10-15  9:25   ` Daniel Wagner

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=20211012070648.28947-4-wagi@monom.org \
    --to=wagi@monom.org \
    --cc=connman@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).