Skip to content

Commit

Permalink
Couple of small fixes here and there
Browse files Browse the repository at this point in the history
- Remove default cases in video module, unsupported platforms are already rejected in main
- Assign NULL pointer to handles after dlclosing them, rookie mistake that was causing useless segfaults
  • Loading branch information
wberube committed May 21, 2024
1 parent c36d810 commit 750710d
Show file tree
Hide file tree
Showing 32 changed files with 100 additions and 109 deletions.
4 changes: 2 additions & 2 deletions src/hal/hisi/v3_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int v3_isp_load(v3_isp_impl *isp_lib) {
}

static void v3_isp_unload(v3_isp_impl *isp_lib) {
if (isp_lib->handle)
dlclose(isp_lib->handle = NULL);
if (isp_lib->handle) dlclose(isp_lib->handle);
isp_lib->handle = NULL;
memset(isp_lib, 0, sizeof(*isp_lib));
}
4 changes: 2 additions & 2 deletions src/hal/hisi/v3_rgn.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static int v3_rgn_load(v3_rgn_impl *rgn_lib) {
}

static void v3_rgn_unload(v3_rgn_impl *rgn_lib) {
if (rgn_lib->handle)
dlclose(rgn_lib->handle = NULL);
if (rgn_lib->handle) dlclose(rgn_lib->handle);
rgn_lib->handle = NULL;
memset(rgn_lib, 0, sizeof(*rgn_lib));
}
24 changes: 12 additions & 12 deletions src/hal/hisi/v3_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ static int v3_sys_load(v3_sys_impl *sys_lib) {
}

static void v3_sys_unload(v3_sys_impl *sys_lib) {
if (sys_lib->handle)
dlclose(sys_lib->handle = NULL);
if (sys_lib->handleGoke)
dlclose(sys_lib->handleGoke = NULL);
if (sys_lib->handleDnvqe)
dlclose(sys_lib->handleDnvqe = NULL);
if (sys_lib->handleVoiceEngine)
dlclose(sys_lib->handleVoiceEngine = NULL);
if (sys_lib->handleUpvqe)
dlclose(sys_lib->handleUpvqe = NULL);
if (sys_lib->handleSecureC)
dlclose(sys_lib->handleSecureC = NULL);
if (sys_lib->handle) dlclose(sys_lib->handle);
sys_lib->handle = NULL;
if (sys_lib->handleGoke) dlclose(sys_lib->handleGoke);
sys_lib->handleGoke = NULL;
if (sys_lib->handleDnvqe) dlclose(sys_lib->handleDnvqe);
sys_lib->handleDnvqe = NULL;
if (sys_lib->handleVoiceEngine) dlclose(sys_lib->handleVoiceEngine);
sys_lib->handleVoiceEngine = NULL;
if (sys_lib->handleUpvqe) dlclose(sys_lib->handleUpvqe);
sys_lib->handleUpvqe = NULL;
if (sys_lib->handleSecureC) dlclose(sys_lib->handleSecureC);
sys_lib->handleSecureC = NULL;
memset(sys_lib, 0, sizeof(*sys_lib));
}
4 changes: 2 additions & 2 deletions src/hal/hisi/v3_vb.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static int v3_vb_load(v3_vb_impl *vb_lib) {
}

static void v3_vb_unload(v3_vb_impl *vb_lib) {
if (vb_lib->handle)
dlclose(vb_lib->handle = NULL);
if (vb_lib->handle) dlclose(vb_lib->handle);
vb_lib->handle = NULL;
memset(vb_lib, 0, sizeof(*vb_lib));
}
4 changes: 2 additions & 2 deletions src/hal/hisi/v3_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static int v3_venc_load(v3_venc_impl *venc_lib) {
}

static void v3_venc_unload(v3_venc_impl *venc_lib) {
if (venc_lib->handle)
dlclose(venc_lib->handle = NULL);
if (venc_lib->handle) dlclose(venc_lib->handle);
venc_lib->handle = NULL;
memset(venc_lib, 0, sizeof(*venc_lib));
}
4 changes: 2 additions & 2 deletions src/hal/hisi/v3_vi.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int v3_vi_load(v3_vi_impl *vi_lib) {
}

static void v3_vi_unload(v3_vi_impl *vi_lib) {
if (vi_lib->handle)
dlclose(vi_lib->handle = NULL);
if (vi_lib->handle) dlclose(vi_lib->handle);
vi_lib->handle = NULL;
memset(vi_lib, 0, sizeof(*vi_lib));
}
4 changes: 2 additions & 2 deletions src/hal/hisi/v3_vpss.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static int v3_vpss_load(v3_vpss_impl *vpss_lib) {
}

static void v3_vpss_unload(v3_vpss_impl *vpss_lib) {
if (vpss_lib->handle)
dlclose(vpss_lib->handle = NULL);
if (vpss_lib->handle) dlclose(vpss_lib->handle);
vpss_lib->handle = NULL;
memset(vpss_lib, 0, sizeof(*vpss_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static int i6_aud_load(i6_aud_impl *aud_lib) {
}

static void i6_aud_unload(i6_aud_impl *aud_lib) {
if (aud_lib->handle)
dlclose(aud_lib->handle = NULL);
if (aud_lib->handle) dlclose(aud_lib->handle);
aud_lib->handle = NULL;
memset(aud_lib, 0, sizeof(*aud_lib));
}
13 changes: 6 additions & 7 deletions src/hal/sstar/i6_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ static int i6_isp_load(i6_isp_impl *isp_lib) {
}

static void i6_isp_unload(i6_isp_impl *isp_lib) {

if (isp_lib->handle)
dlclose(isp_lib->handle = NULL);
if (isp_lib->handleCus3a)
dlclose(isp_lib->handleCus3a = NULL);
if (isp_lib->handleIspAlgo)
dlclose(isp_lib->handleIspAlgo = NULL);
if (isp_lib->handle) dlclose(isp_lib->handle);
isp_lib->handle = NULL;
if (isp_lib->handleCus3a) dlclose(isp_lib->handleCus3a);
isp_lib->handleCus3a = NULL;
if (isp_lib->handleIspAlgo) dlclose(isp_lib->handleIspAlgo);
isp_lib->handleIspAlgo = NULL;
memset(isp_lib, 0, sizeof(*isp_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6_rgn.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int i6_rgn_load(i6_rgn_impl *rgn_lib) {
}

static void i6_rgn_unload(i6_rgn_impl *rgn_lib) {
if (rgn_lib->handle)
dlclose(rgn_lib->handle = NULL);
if (rgn_lib->handle) dlclose(rgn_lib->handle);
rgn_lib->handle = NULL;
memset(rgn_lib, 0, sizeof(*rgn_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6_snr.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static int i6_snr_load(i6_snr_impl *snr_lib) {
}

static void i6_snr_unload(i6_snr_impl *snr_lib) {
if (snr_lib->handle)
dlclose(snr_lib->handle = NULL);
if (snr_lib->handle) dlclose(snr_lib->handle);
snr_lib->handle = NULL;
memset(snr_lib, 0, sizeof(*snr_lib));
}
8 changes: 4 additions & 4 deletions src/hal/sstar/i6_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ static int i6_sys_load(i6_sys_impl *sys_lib) {
}

static void i6_sys_unload(i6_sys_impl *sys_lib) {
if (sys_lib->handle)
dlclose(sys_lib->handle = NULL);
if (sys_lib->handleCamOsWrapper)
dlclose(sys_lib->handleCamOsWrapper = NULL);
if (sys_lib->handle) dlclose(sys_lib->handle);
sys_lib->handle = NULL;
if (sys_lib->handleCamOsWrapper) dlclose(sys_lib->handleCamOsWrapper);
sys_lib->handleCamOsWrapper = NULL;
memset(sys_lib, 0, sizeof(*sys_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static int i6_venc_load(i6_venc_impl *venc_lib) {
}

static void i6_venc_unload(i6_venc_impl *venc_lib) {
if (venc_lib->handle)
dlclose(venc_lib->handle = NULL);
if (venc_lib->handle) dlclose(venc_lib->handle);
venc_lib->handle = NULL;
memset(venc_lib, 0, sizeof(*venc_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6_vif.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int i6_vif_load(i6_vif_impl *vif_lib) {
}

static void i6_vif_unload(i6_vif_impl *vif_lib) {
if (vif_lib->handle)
dlclose(vif_lib->handle = NULL);
if (vif_lib->handle) dlclose(vif_lib->handle);
vif_lib->handle = NULL;
memset(vif_lib, 0, sizeof(*vif_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6_vpe.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static int i6_vpe_load(i6_vpe_impl *vpe_lib) {
}

static void i6_vpe_unload(i6_vpe_impl *vpe_lib) {
if (vpe_lib->handle)
dlclose(vpe_lib->handle = NULL);
if (vpe_lib->handle) dlclose(vpe_lib->handle);
vpe_lib->handle = NULL;
memset(vpe_lib, 0, sizeof(*vpe_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6c_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static int i6c_aud_load(i6c_aud_impl *aud_lib) {
}

static void i6c_aud_unload(i6c_aud_impl *aud_lib) {
if (aud_lib->handle)
dlclose(aud_lib->handle = NULL);
if (aud_lib->handle) dlclose(aud_lib->handle);
aud_lib->handle = NULL;
memset(aud_lib, 0, sizeof(*aud_lib));
}
12 changes: 6 additions & 6 deletions src/hal/sstar/i6c_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ static int i6c_isp_load(i6c_isp_impl *isp_lib) {
}

static void i6c_isp_unload(i6c_isp_impl *isp_lib) {
if (isp_lib->handle)
dlclose(isp_lib->handle = NULL);
if (isp_lib->handleCus3a)
dlclose(isp_lib->handleCus3a = NULL);
if (isp_lib->handleIspAlgo)
dlclose(isp_lib->handleIspAlgo = NULL);
if (isp_lib->handle) dlclose(isp_lib->handle);
isp_lib->handle = NULL;
if (isp_lib->handleCus3a) dlclose(isp_lib->handleCus3a);
isp_lib->handleCus3a = NULL;
if (isp_lib->handleIspAlgo) dlclose(isp_lib->handleIspAlgo);
isp_lib->handleIspAlgo = NULL;
memset(isp_lib, 0, sizeof(*isp_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6c_rgn.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int i6c_rgn_load(i6c_rgn_impl *rgn_lib) {
}

static void i6c_rgn_unload(i6c_rgn_impl *rgn_lib) {
if (rgn_lib->handle)
dlclose(rgn_lib->handle = NULL);
if (rgn_lib->handle) dlclose(rgn_lib->handle);
rgn_lib->handle = NULL;
memset(rgn_lib, 0, sizeof(*rgn_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6c_scl.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static int i6c_scl_load(i6c_scl_impl *scl_lib) {
}

static void i6c_scl_unload(i6c_scl_impl *scl_lib) {
if (scl_lib->handle)
dlclose(scl_lib->handle = NULL);
if (scl_lib->handle) dlclose(scl_lib->handle);
scl_lib->handle = NULL;
memset(scl_lib, 0, sizeof(*scl_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6c_snr.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int i6c_snr_load(i6c_snr_impl *snr_lib) {
}

static void i6c_snr_unload(i6c_snr_impl *snr_lib) {
if (snr_lib->handle)
dlclose(snr_lib->handle = NULL);
if (snr_lib->handle) dlclose(snr_lib->handle);
snr_lib->handle = NULL;
memset(snr_lib, 0, sizeof(*snr_lib));
}
8 changes: 4 additions & 4 deletions src/hal/sstar/i6c_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ static int i6c_sys_load(i6c_sys_impl *sys_lib) {
}

static void i6c_sys_unload(i6c_sys_impl *sys_lib) {
if (sys_lib->handle)
dlclose(sys_lib->handle = NULL);
if (sys_lib->handleCamOsWrapper)
dlclose(sys_lib->handleCamOsWrapper = NULL);
if (sys_lib->handle) dlclose(sys_lib->handle);
sys_lib->handle = NULL;
if (sys_lib->handleCamOsWrapper) dlclose(sys_lib->handleCamOsWrapper);
sys_lib->handleCamOsWrapper = NULL;
memset(sys_lib, 0, sizeof(*sys_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6c_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static int i6c_venc_load(i6c_venc_impl *venc_lib) {
}

static void i6c_venc_unload(i6c_venc_impl *venc_lib) {
if (venc_lib->handle)
dlclose(venc_lib->handle = NULL);
if (venc_lib->handle) dlclose(venc_lib->handle);
venc_lib->handle = NULL;
memset(venc_lib, 0, sizeof(*venc_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6c_vif.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int i6c_vif_load(i6c_vif_impl *vif_lib) {
}

static void i6c_vif_unload(i6c_vif_impl *vif_lib) {
if (vif_lib->handle)
dlclose(vif_lib->handle = NULL);
if (vif_lib->handle) dlclose(vif_lib->handle);
vif_lib->handle = NULL;
memset(vif_lib, 0, sizeof(*vif_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6f_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static int i6f_aud_load(i6f_aud_impl *aud_lib) {
}

static void i6f_aud_unload(i6f_aud_impl *aud_lib) {
if (aud_lib->handle)
dlclose(aud_lib->handle = NULL);
if (aud_lib->handle) dlclose(aud_lib->handle);
aud_lib->handle = NULL;
memset(aud_lib, 0, sizeof(*aud_lib));
}
12 changes: 6 additions & 6 deletions src/hal/sstar/i6f_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ static int i6f_isp_load(i6f_isp_impl *isp_lib) {
}

static void i6f_isp_unload(i6f_isp_impl *isp_lib) {
if (isp_lib->handle)
dlclose(isp_lib->handle = NULL);
if (isp_lib->handleCus3a)
dlclose(isp_lib->handleCus3a = NULL);
if (isp_lib->handleIspAlgo)
dlclose(isp_lib->handleIspAlgo = NULL);
if (isp_lib->handle) dlclose(isp_lib->handle);
isp_lib->handle = NULL;
if (isp_lib->handleCus3a) dlclose(isp_lib->handleCus3a);
isp_lib->handleCus3a = NULL;
if (isp_lib->handleIspAlgo) dlclose(isp_lib->handleIspAlgo);
isp_lib->handleIspAlgo = NULL;
memset(isp_lib, 0, sizeof(*isp_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6f_rgn.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int i6f_rgn_load(i6f_rgn_impl *rgn_lib) {
}

static void i6f_rgn_unload(i6f_rgn_impl *rgn_lib) {
if (rgn_lib->handle)
dlclose(rgn_lib->handle = NULL);
if (rgn_lib->handle) dlclose(rgn_lib->handle);
rgn_lib->handle = NULL;
memset(rgn_lib, 0, sizeof(*rgn_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6f_scl.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int i6f_scl_load(i6f_scl_impl *scl_lib) {
}

static void i6f_scl_unload(i6f_scl_impl *scl_lib) {
if (scl_lib->handle)
dlclose(scl_lib->handle = NULL);
if (scl_lib->handle) dlclose(scl_lib->handle);
scl_lib->handle = NULL;
memset(scl_lib, 0, sizeof(*scl_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6f_snr.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int i6f_snr_load(i6f_snr_impl *snr_lib) {
}

static void i6f_snr_unload(i6f_snr_impl *snr_lib) {
if (snr_lib->handle)
dlclose(snr_lib->handle = NULL);
if (snr_lib->handle) dlclose(snr_lib->handle);
snr_lib->handle = NULL;
memset(snr_lib, 0, sizeof(*snr_lib));
}
8 changes: 4 additions & 4 deletions src/hal/sstar/i6f_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ static int i6f_sys_load(i6f_sys_impl *sys_lib) {
}

static void i6f_sys_unload(i6f_sys_impl *sys_lib) {
if (sys_lib->handle)
dlclose(sys_lib->handle = NULL);
if (sys_lib->handleCamOsWrapper)
dlclose(sys_lib->handleCamOsWrapper = NULL);
if (sys_lib->handle) dlclose(sys_lib->handle);
sys_lib->handle = NULL;
if (sys_lib->handleCamOsWrapper) dlclose(sys_lib->handleCamOsWrapper);
sys_lib->handleCamOsWrapper = NULL;
memset(sys_lib, 0, sizeof(*sys_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6f_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static int i6f_venc_load(i6f_venc_impl *venc_lib) {
}

static void i6f_venc_unload(i6f_venc_impl *venc_lib) {
if (venc_lib->handle)
dlclose(venc_lib->handle = NULL);
if (venc_lib->handle) dlclose(venc_lib->handle);
venc_lib->handle = NULL;
memset(venc_lib, 0, sizeof(*venc_lib));
}
4 changes: 2 additions & 2 deletions src/hal/sstar/i6f_vif.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int i6f_vif_load(i6f_vif_impl *vif_lib) {
}

static void i6f_vif_unload(i6f_vif_impl *vif_lib) {
if (vif_lib->handle)
dlclose(vif_lib->handle = NULL);
if (vif_lib->handle) dlclose(vif_lib->handle);
vif_lib->handle = NULL;
memset(vif_lib, 0, sizeof(*vif_lib));
}
Loading

0 comments on commit 750710d

Please sign in to comment.