Browse Source

qcacmn: fix api for getting first vdev

As per the current design we are trying to take a ref
for the vdev even when there are no active vdev.
Fix this by adding a NULL check.

CRs-Fixed: 2262983
Change-Id: Iac62c9d0e1138c3d150a179546ad7793ff61e3db
Edayilliam Jayadev 6 years ago
parent
commit
3822826445
1 changed files with 3 additions and 4 deletions
  1. 3 4
      target_if/spectral/target_if_spectral.c

+ 3 - 4
target_if/spectral/target_if_spectral.c

@@ -75,14 +75,13 @@ target_if_spectral_get_vdev(struct target_if_spectral *spectral)
 
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_SPECTRAL_ID);
 
+	if (!first_vdev)
+		return NULL;
+
 	if (wlan_objmgr_vdev_try_get_ref(first_vdev, WLAN_SPECTRAL_ID) !=
 			QDF_STATUS_SUCCESS)
 		first_vdev = NULL;
 
-	if (!first_vdev) {
-		spectral_warn("Unable to get first vdev of pdev.");
-		return NULL;
-	}
 
 	return first_vdev;
 }