From: kernel test robot <lkp@xxxxxxxxx> Condition !A || A && B is equivalent to !A || B. Generated by: scripts/coccinelle/misc/excluded_middle.cocci Fixes: b76f0ea01312 ("coccinelle: misc: add excluded_middle.cocci script") CC: Denis Efremov <efremov@xxxxxxxxx> Reported-by: kernel test robot <lkp@xxxxxxxxx> Signed-off-by: kernel test robot <lkp@xxxxxxxxx> Signed-off-by: Julia Lawall <julia.lawall@xxxxxxxx> --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 585e5b17b92dead8a3aca4e3c9876fbca5f7e0ba commit: b76f0ea013125358d1b4ca147a6f9b6883dd2493 coccinelle: misc: add excluded_middle.cocci script :::::: branch date: 14 hours ago :::::: commit date: 8 weeks ago Please take the patch only if it's a positive warning. Thanks! adf_dev_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/qat/qat_common/adf_dev_mgr.c +++ b/drivers/crypto/qat/qat_common/adf_dev_mgr.c @@ -152,7 +152,7 @@ int adf_devmgr_add_dev(struct adf_accel_ atomic_set(&accel_dev->ref_count, 0); /* PF on host or VF on guest */ - if (!accel_dev->is_vf || (accel_dev->is_vf && !pf)) { + if (!accel_dev->is_vf || !pf) { struct vf_id_map *map; list_for_each(itr, &accel_table) { @@ -248,7 +248,7 @@ void adf_devmgr_rm_dev(struct adf_accel_ struct adf_accel_dev *pf) { mutex_lock(&table_lock); - if (!accel_dev->is_vf || (accel_dev->is_vf && !pf)) { + if (!accel_dev->is_vf || !pf) { id_map[accel_dev->accel_id] = 0; num_devices--; } else if (accel_dev->is_vf && pf) {