spi: Fix cocci warnings
authorWilliam Zhang <william.zhang@broadcom.com>
Tue, 7 Mar 2023 01:20:04 +0000 (17:20 -0800)
committerMark Brown <broonie@kernel.org>
Tue, 7 Mar 2023 13:58:41 +0000 (13:58 +0000)
cocci reported warning: !A || A && B is equivalent to !A || B. This fix
simplified the condition check to !A || B.

Fixes: 76a85704cb91 ("spi: spi-mem: Allow controller supporting mem_ops without exec_op")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202303010051.HrHWSr9y-lkp@intel.com/
Signed-off-by: William Zhang <william.zhang@broadcom.com>
Link: https://lore.kernel.org/r/20230307012004.414502-1-william.zhang@broadcom.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index 295d02e7f0a88971937a6b1a6c7a77f4c2a9d539..c725b4bab7af41129451d73129d202d528fb804b 100644 (file)
@@ -3076,7 +3076,7 @@ static int spi_controller_check_ops(struct spi_controller *ctlr)
         * If ->mem_ops or ->mem_ops->exec_op is NULL, we request that at least
         * one of the ->transfer_xxx() method be implemented.
         */
-       if (!ctlr->mem_ops || (ctlr->mem_ops && !ctlr->mem_ops->exec_op)) {
+       if (!ctlr->mem_ops || !ctlr->mem_ops->exec_op) {
                if (!ctlr->transfer && !ctlr->transfer_one &&
                   !ctlr->transfer_one_message) {
                        return -EINVAL;