[Spice-devel] [PATCH libcacard] nss: remove unused module_has_removable_hw_slots() check

Victor Toso victortoso at redhat.com
Fri Aug 3 11:27:38 UTC 2018


Hi,

On Fri, Aug 03, 2018 at 12:44:30PM +0200, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> The check result is unused, the following loop over module list
> doesn't need it anyway.

Seems that this code you are removing became obsolete at

 | commit 8f159d0833a37cbe09376dd2f398c6595ad02dc9
 | Author: Marc-André Lureau <mlureau at redhat.com>
 | Date:   Wed Mar 20 14:07:49 2013 +0100
 |
 | libcacard: remove default libcoolkey loading
 |
 | Use only the modules defined in the NSS database.
 |
 | Signed-off-by: Marc-André Lureau <mlureau at redhat.com>
 | Reviewed-by: Alon Levy <alevy at redhat.com>

You could add that reference to commit log

> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

Acked-by: Victor Toso <victortoso at redhat.com>

> ---
>  src/vcard_emul_nss.c | 32 --------------------------------
>  1 file changed, 32 deletions(-)
> 
> diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c
> index d106436..8a56343 100644
> --- a/src/vcard_emul_nss.c
> +++ b/src/vcard_emul_nss.c
> @@ -878,30 +878,6 @@ vcard_emul_force_card_insert(VReader *vreader)
>      return VCARD_EMUL_OK;
>  }
>  
> -
> -static PRBool
> -module_has_removable_hw_slots(SECMODModule *mod)
> -{
> -    int i;
> -    PRBool ret = PR_FALSE;
> -    SECMODListLock *moduleLock = SECMOD_GetDefaultModuleListLock();
> -
> -    if (!moduleLock) {
> -        PORT_SetError(SEC_ERROR_NOT_INITIALIZED);
> -        return ret;
> -    }
> -    SECMOD_GetReadLock(moduleLock);
> -    for (i = 0; i < mod->slotCount; i++) {
> -        PK11SlotInfo *slot = mod->slots[i];
> -        if (PK11_IsRemovable(slot) && PK11_IsHW(slot)) {
> -            ret = PR_TRUE;
> -            break;
> -        }
> -    }
> -    SECMOD_ReleaseReadLock(moduleLock);
> -    return ret;
> -}
> -
>  /* Previously we returned FAIL if no readers found. This makes
>   * no sense when using hardware, since there may be no readers connected
>   * at the time vcard_emul_init is called, but they will be properly
> @@ -1041,14 +1017,6 @@ vcard_emul_init(const VCardEmulOptions *options)
>      /* make sure we have some PKCS #11 module loaded */
>      module_lock = SECMOD_GetDefaultModuleListLock();
>      module_list = SECMOD_GetDefaultModuleList();
> -    SECMOD_GetReadLock(module_lock);
> -    for (mlp = module_list; mlp; mlp = mlp->next) {
> -        SECMODModule *module = mlp->module;
> -        if (module_has_removable_hw_slots(module)) {
> -            break;
> -        }
> -    }
> -    SECMOD_ReleaseReadLock(module_lock);
>  
>      /* now examine all the slots, finding which should be readers */
>      /* We should control this with options. For now we mirror out any
> -- 
> 2.18.0.321.gffc6fa0e39
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180803/0dad6806/attachment.sig>


More information about the Spice-devel mailing list