[PATCH net-next] ceph: remove unnecessary non NULL check for request_key

Subsystems: ceph common code (libceph), the rest

STALE2923d

2 messages, 2 authors, 2018-08-07 · open the first message on its own page

[PATCH net-next] ceph: remove unnecessary non NULL check for request_key

From: YueHaibing <hidden>
Date: 2018-08-07 13:03:38

request_key never return NULL,so no need do non-NULL check.

Signed-off-by: YueHaibing <redacted>
---
 net/ceph/ceph_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 584fdbe..9834edc 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -304,7 +304,7 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) {
 	struct ceph_crypto_key *ckey;
 
 	ukey = request_key(&key_type_ceph, name, NULL);
-	if (!ukey || IS_ERR(ukey)) {
+	if (IS_ERR(ukey)) {
 		/* request_key errors don't map nicely to mount(2)
 		   errors; don't even try, but still printk */
 		key_err = PTR_ERR(ukey);
-- 
2.7.0

Re: [PATCH net-next] ceph: remove unnecessary non NULL check for request_key

From: Ilya Dryomov <idryomov@gmail.com>
Date: 2018-08-07 15:02:18

On Tue, Aug 7, 2018 at 3:03 PM YueHaibing [off-list ref] wrote:
quoted hunk
request_key never return NULL,so no need do non-NULL check.

Signed-off-by: YueHaibing <redacted>
---
 net/ceph/ceph_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 584fdbe..9834edc 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -304,7 +304,7 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) {
        struct ceph_crypto_key *ckey;

        ukey = request_key(&key_type_ceph, name, NULL);
-       if (!ukey || IS_ERR(ukey)) {
+       if (IS_ERR(ukey)) {
                /* request_key errors don't map nicely to mount(2)
                   errors; don't even try, but still printk */
                key_err = PTR_ERR(ukey);
Applied.

Thanks,

                Ilya
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help