Thread (13 messages) 13 messages, 2 authors, 2021-01-22

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

From: Eric Biggers <ebiggers@kernel.org>
Date: 2021-01-21 18:26:26
Also in: linux-arm-msm, linux-fscrypt, linux-mmc

On Thu, Jan 21, 2021 at 02:04:37PM +0100, Ulf Hansson wrote:
quoted
+#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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help