crypto: ux500 - Use proper enum in hash_set_dma_transfer
PATCH 1/1 crypto: ux500 - Use proper enum in hash_set_dma_transfer
Clang warns when one enumerated type is implicitly converted to another:
drivers/crypto/ux500/hash/hash_core.c:169:4: warning: implicit conversion from enumeration type 'enum dma_data_direction' to different enumeration type 'enum dma_transfer_direction' [-Wenum-conversion]
direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT);
^~~~~~~~~1 warning generated.
dmaengine_prep_slave_sg expects an enum from dma_transfer_direction. We know that the only direction supported by this function is DMA_TO_DEVICE because of the check at the top of this function so we can just use the equivalent value from dma_transfer_direction.
DMA_TO_DEVICE = DMA_MEM_TO_DEV = 1
--- drivers/crypto/ux500/hash/hash_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ux500/hash/hash_core.c +1 -1
@@ -166,7 +166,7 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, __func__); desc =dmaengine_prep_slave_sg (channel, ctx->device->dma.sg, ctx->device->dma.sg_len, - direction,DMA_CTRL_ACK |DMA_PREP_INTERRUPT ); +DMA_MEM_TO_DEV ,DMA_CTRL_ACK |DMA_PREP_INTERRUPT );if (!desc) {dev_err (ctx->device->dev,"%s: dmaengine_prep_slave_sg() failed!\n" , __func__);
Signature · 1 line
2.20.0
Quoted 6 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another:
drivers/crypto/ux500/hash/hash_core.c:169:4: warning: implicit conversion from enumeration type 'enumdma_data_direction' to different enumeration type 'enumdma_transfer_direction' [-Wenum-conversion]
Quoted 8 lines
direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); ^~~~~~~~~1 warning generated.
dmaengine_prep_slave_sgexpects an enum fromdma_transfer_direction. We know that the only direction supported by this function isDMA_TO_DEVICEbecause of the check at the top of this function so we can just use the equivalent value fromdma_transfer_direction.
That's correct. Thanks for fixing up yet another one of these enum confusions. (I'm beginning to think we should change the values of the enum members so that things break when aliased as such. Unfortunately, that would result in runtime bugs rather than strong type system based compile time checks; but this warning from Clang helps).
Quoted 24 lines
DMA_TO_DEVICE=DMA_MEM_TO_DEV= 1Signed-off-by Nathan Chancellor <[email protected]>--- drivers/crypto/ux500/hash/hash_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/crypto/ux500/hash/hash_core.c +1
-2@@ -166,7 +166,7 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg, __func__); desc =dmaengine_prep_slave_sg (channel, ctx->device->dma.sg, ctx->device->dma.sg_len, - direction,DMA_CTRL_ACK |DMA_PREP_INTERRUPT ); +DMA_MEM_TO_DEV ,DMA_CTRL_ACK |DMA_PREP_INTERRUPT );if (!desc) {dev_err (ctx->device->dev,"%s: dmaengine_prep_slave_sg() failed!\n" , __func__); --2.20.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Herbert Xu
maintainerQuoted 14 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another:
drivers/crypto/ux500/hash/hash_core.c:169:4: warning: implicit conversion from enumeration type 'enumdma_data_direction' to different enumeration type 'enumdma_transfer_direction' [-Wenum-conversion]direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT); ^~~~~~~~~1 warning generated.
dmaengine_prep_slave_sgexpects an enum fromdma_transfer_direction. We know that the only direction supported by this function isDMA_TO_DEVICEbecause of the check at the top of this function so we can just use the equivalent value fromdma_transfer_direction.
Quoted 6 lines
DMA_TO_DEVICE=DMA_MEM_TO_DEV= 1Signed-off-by Nathan Chancellor <[email protected]>--- drivers/crypto/ux500/hash/hash_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt