kdbus: remove remaining dead code when kdbus policy is disabled 98/306998/1 accepted/tizen/unified/20240306.011949 accepted/tizen/unified/toolchain/20240311.065909 accepted/tizen/unified/x/20240307.010730
authorMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 1 Mar 2024 21:59:11 +0000 (22:59 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 1 Mar 2024 22:08:11 +0000 (23:08 +0100)
Include all kdbus policy related code conditionally to avoid warnings
about unused functions and variables.

Change-Id: I9b32ac5c4b0318138a96fd9b76896cc0042ff038
Fixes: 0020510 ("Fix disabling kdbus policy resulting in dead code")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
kernel/kdbus/connection.c

index 4d4c754f8b983c40270323bcd701696db870a6c5..8a9985bfe2665f25939eef918aae802b5ac44630 100644 (file)
@@ -1375,6 +1375,7 @@ void kdbus_conn_move_messages(struct kdbus_conn *conn_dst,
        wake_up_interruptible(&conn_dst->wait);
 }
 
+#ifndef DISABLE_KDBUS_POLICY
 /* query the policy-database for all names of @whom */
 static bool kdbus_conn_policy_query_all(struct kdbus_conn *conn,
                                        const struct cred *conn_creds,
@@ -1410,6 +1411,7 @@ static bool kdbus_conn_policy_query_all(struct kdbus_conn *conn,
 
        return pass;
 }
+#endif
 
 /**
  * kdbus_conn_policy_own_name() - verify a connection can own the given name
@@ -1425,12 +1427,11 @@ bool kdbus_conn_policy_own_name(struct kdbus_conn *conn,
                                const struct cred *conn_creds,
                                const char *name)
 {
-       unsigned int hash = kdbus_strhash(name);
-       int res;
-
 #ifdef DISABLE_KDBUS_POLICY
        return true;
 #else
+       unsigned int hash = kdbus_strhash(name);
+       int res;
 
        if (!conn_creds)
                conn_creds = conn->cred;
@@ -1505,11 +1506,10 @@ bool kdbus_conn_policy_see_name_unlocked(struct kdbus_conn *conn,
                                         const struct cred *conn_creds,
                                         const char *name)
 {
-       int res;
-
 #ifdef DISABLE_KDBUS_POLICY
        return true;
 #else
+       int res;
 
        /*
         * By default, all names are visible on a bus. SEE policies can only be