Received: by 10.213.65.68 with SMTP id h4csp451987imn; Sat, 31 Mar 2018 01:50:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Zl3JtmZGeKC7kuBA/GQHs0ooCfQhrwJHIt6iTOtKqMwc6sBzwPsgg7JM9IWDJofNN5UFP X-Received: by 10.167.130.88 with SMTP id e24mr1665989pfn.66.1522486251543; Sat, 31 Mar 2018 01:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522486251; cv=none; d=google.com; s=arc-20160816; b=Jr29MaEHVroiRnnXQWKE0Vr/P9OVVejrlwGPNyjFlulcR3cRhXM88SsudBPNPZ3Lut EAhDsvS7XlAoX3B1U3FeLsIE5aKYD76rvjrHS1A4pfCe+/36JUlXJZmA5eNsaOL+FuVF XauRXTJsMswYqhUudakdbhLTuQwaoX4Q53xVdNBGdm9rauRCrauAROf/CulQsjF80KCY Q4ouk80HT1kdASxjPrQKeclToRls94zME4hFSXs7J/NDr5kqFGtio9LY1RuTw/JmIL81 o+73kMRRndlRhVHeh9U+AjUkWA2q5WIJWuX1s/nqOVdZw/szDjAiBPIwPGJJNmlbIiw+ nhug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=73UOIo5N2k8rt/1szAWsObcLvLXeEbx/kCN+lro4FcQ=; b=k/8fgOBM/XXc/+3Kd3Fuu3L+WhArL70ytl1rG5EOIYPnwOkUrXO8zKeG74qmYyT/dP xnKiCWCeq05Zgm7TvJlbTG761PGBzzj/bydU0NKNbvftzDRuLuRLcIXJcLENVajN1TKH mki1i4hitrZ1hB+PxNhwriWZalYbHzyk1IqHRwtg5pWGSVjrpSvW1DbYxOb5IPdD4L3m bNi43hYVJ8587nP244rdhuqm8V883DyIvZseRMTjrK8Y+7Qtv+eHalqJr4cIGe6QHOfV yn/P5K97fGpuJiLwr9d3ok4UC7LML/oQZfmSyvyeMsgXDQUYSvKmyIhcPJ+XTKno8E7k 2/GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VDgJSZT9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si1211522pfi.310.2018.03.31.01.50.36; Sat, 31 Mar 2018 01:50:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VDgJSZT9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752422AbeCaIt2 (ORCPT + 99 others); Sat, 31 Mar 2018 04:49:28 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:38871 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbeCaIt0 (ORCPT ); Sat, 31 Mar 2018 04:49:26 -0400 Received: by mail-it0-f68.google.com with SMTP id 19-v6so13536236itw.3; Sat, 31 Mar 2018 01:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=73UOIo5N2k8rt/1szAWsObcLvLXeEbx/kCN+lro4FcQ=; b=VDgJSZT9Z5GByQRHqC/3+PNAXXjvghWiIarTAs84A2VdH62YdHWJzAXQobWhCjMcx/ hHgvtF0Dlsq94XHrcULZ48bFX+I2CvovQNA2GsbYbn1zjU3ugiaBH1Xl+RKnuR3G8NF+ r33k+AIvBw70c/tKD3XnvmbkHT9wFp6jejffmKLb8LcYB/p+maguEwGFMTjJQEG9aNT5 sMMNOMtxfIasc6FlgNKEahEkyT+kNG/kPyJNMwptwP4YroukKejY80Ri6d1mi44DZxXR az4VXyWhBeNmAEPv0LXxSBNRSZXB5aeNqenWPm2uA+9X/XEhsqVMSyv3HTbZcT7tTP43 K6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=73UOIo5N2k8rt/1szAWsObcLvLXeEbx/kCN+lro4FcQ=; b=KbpIqGpIZDnFo22tJYsCNFGKuPfhAAow2qw5dZmS3tlJtl3VomtXj5O1QIVGA2ElUD 6zy+BPQXPL+6K6zjww5W/WdHE5Hd9Zbupy/9jyssQPtBoHjHhN7C7khTY9ZK/ybK47G+ n7ONcJdOo9m1ih0PokIgZ9r7MrcKnORtS1Lq6+TTnh5WHATpmz/+HiPKuWAxTqYUf8LT +LRv5zMRSpWjsrgQqu3q8sxBxSyTeejjRrnDEzP/yifrNI6+Fo/bHrNKqcNS8zs3IjEr 1zQWQNklDzHngLNeDexv8w8Qwg7ml5fF1y2HQcZeJS0uwbfami+p7xnkIFAythvhnqEt EK4g== X-Gm-Message-State: AElRT7GPRTO51M9una2P+YfwwcPURinRVKP7FHv5JB0QcKZ7btglPYJ1 z83vWJlm0/qvhZcuqafycnUlxmwIPcexS1f2B94= X-Received: by 2002:a24:2d0:: with SMTP id 199-v6mr5975397itu.23.1522486165173; Sat, 31 Mar 2018 01:49:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.8.201 with HTTP; Sat, 31 Mar 2018 01:48:44 -0700 (PDT) In-Reply-To: References: <20180328175736.17360-1-rvarsha016@gmail.com> <1522260676.12357.121.camel@perches.com> From: Varsha Rao Date: Sat, 31 Mar 2018 14:18:44 +0530 Message-ID: Subject: Re: [Cocci] [PATCH] crypto: cavium: zip: Remove unnecessary parentheses To: Julia Lawall Cc: Joe Perches , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, cocci , Herbert Xu , "David S. Miller" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 31, 2018 at 11:48 AM, Julia Lawall wrote: > On Thu, 29 Mar 2018, Varsha Rao wrote: > >> On Wed, Mar 28, 2018 at 11:41 PM, Joe Perches wrote: >> > >> > On Wed, 2018-03-28 at 23:27, Varsha Rao wrote: >> > > This patch fixes the clang warning of extraneous parentheses, with the >> > > following coccinelle script. >> > > >> > > @@ >> > > identifier i; >> > > constant c; >> > > @@ >> > > ( >> > > -((i == c)) >> > > +i == c >> > > > >> > > >> > > -((i <= c)) >> > > +i <= c >> > >> > Why just the "==" and "<=" cases? >> > Why not "<", ">" and ">=" too? >> > >> > Why not expression instead of constant? >> >> Initially I had the other cases too and used expression instead of >> constant. But the results included only "==" and "<=" cases with >> constant. Along with one false positive case. >> >> --- a/drivers/crypto/cavium/zip/zip_main.c >> +++ b/drivers/crypto/cavium/zip/zip_main.c >> @@ -99,7 +99,7 @@ static struct zip_device *zip_alloc_devi >> */ >> struct zip_device *zip_get_device(int node) >> { >> - if ((node < MAX_ZIP_DEVICES) && (node >= 0)) >> + if (node < MAX_ZIP_DEVICES && node >= 0) > > Why is it a false positive? The parentheses around multiple expressions in if statement is not considered extra, right? Thanks, Varsha > julia > >> return zip_dev[node]; >> >> zip_err("ZIP device not found for node id %d\n", node); >> >> I checked if there was any case of extra parentheses around relational >> operators left, but there were none. Hence, in the script I included >> only the cases present in the result. >> >> Thanks, >> Varsha >> _______________________________________________ >> Cocci mailing list >> Cocci@systeme.lip6.fr >> https://systeme.lip6.fr/mailman/listinfo/cocci >>