Re: [PATCH v5 4/9] mmc: cqhci: add support for inline encryption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 21, 2021 at 02:04:37PM +0100, Ulf Hansson wrote:
> > +#else /* CONFIG_MMC_CRYPTO */
> > +
> > +static inline int cqhci_crypto_init(struct cqhci_host *host)
> > +{
> > +       return 0;
> 
> The host calling this function may have MMC_CAP2_CRYPTO set for it.
> 
> When CONFIG_MMC_CRYPTO is set, cqhci_crypto_init() may unset
> MMC_CAP2_CRYPTO if initialization fails. It seems like we should unset
> MMC_CAP2_CRYPTO in this stub function as well, right?

The code in sdhci-msm.c that sets MMC_CAP2_CRYPTO is conditional on
CONFIG_MMC_CRYPTO.  So, MMC_CAP2_CRYPTO won't be set when !CONFIG_MMC_CRYPTO.

I suppose we might as well do something to stop other drivers from accidentally
getting that wrong, though.

How about just defining the flag to 0 when !CONFIG_MMC_CRYPTO:

#ifdef CONFIG_MMC_CRYPTO
#define MMC_CAP2_CRYPTO         (1 << 27)       /* Host supports inline encryption */
#else
#define MMC_CAP2_CRYPTO         0
#endif

That would be more reliable than relying on the flag getting cleared by
something.

- Eric



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux