nfctype1: Improve nfctype1_read readability
authorWiktor Lawski <wiktor.lawski@tieto.com>
Wed, 19 Sep 2012 13:20:44 +0000 (15:20 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 21 Sep 2012 07:20:51 +0000 (09:20 +0200)
WHEN either uid is NULL or uid_length is not equal to UID_LENGTH AND uid is
not NULL, uid_length must to be NOT equal to UID_LENGTH, so additional
conditional in if statement is not necessary. It will be always true. It is
only harder to analyze function code.

plugins/nfctype1.c

index 7fb4e0c..d7ba35e 100644 (file)
@@ -412,7 +412,7 @@ static int nfctype1_read(uint32_t adapter_idx,
 
        uid = near_tag_get_nfcid(adapter_idx, target_idx, &uid_length);
        if (uid == NULL || uid_length != UID_LENGTH) {
-               if (uid != NULL && uid_length != UID_LENGTH) {
+               if (uid != NULL) {
                        near_error("Invalid UID");
 
                        g_free(uid);