Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2924347ybi; Thu, 4 Jul 2019 22:30:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqypVCCIQmM/LuiSSnK9OIODXdWQ7DkePHE37jwK4WojsLFKkP9mcFHaNPiqVC4Fly1Qn7ma X-Received: by 2002:a17:902:24c:: with SMTP id 70mr2618512plc.2.1562304658370; Thu, 04 Jul 2019 22:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562304658; cv=none; d=google.com; s=arc-20160816; b=i0bQ/UullTPZC3veaX7o0kWQswBq6stUUP4MXTz1To32dkgaN8vK9815hQHzgjUitL I4/wbymT6VGQknaEJmM998Gepbzdtd70KzEnpqKM9iygY+X/UmJ3wqBij8f9Sb0uCjtc D6jKlb1ZMvq+w0gWV9p+byJz952b5J3o8hgdCAH6m4rUwhQ+vl0quow5V93ho4krCq+5 t6FNxCnlScDMtW9Lu5imfPMSMXj+lS6o0QFYe32BGfTsZG1RYBxlrZhZMM+A2zFZBopX 034C8kxSYuwdlEhKnNBJeWhNvPytA56S2yjZn6rtXVHDfzoVpD7fBhL/24rJpd2xQWWp 4UgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=oZanuD7CyBmLNCoLdEPEdZVY0t/hSrZcX1ib3wtlHkg=; b=jydrvI7Es0oZ4Z15vIFynCdHkye5dd+DdN4I2ARA2jpNgVu4Yx2oPJF/s3YX6kKWgU K9CedIPRi0HUuy4V8+8BILdRKC8myL4h8MJLT02YsdXHQdEO8YH7NQjHkWZPGSsXLRFD 1Yi++m2++F0Pqp4yg/6wy+aSA++sPu8Nc5tJ0eDSgCb+6PNhkiVHcxX8KtfzkFYR1Rzd YS3rOyll+Foi6FWvbbFCjJ/T/B79lCVos8pmXACLNuZG1r3w1FlKN+rKTiFuXE+Ce0KC d4akgWqsjkYFsw6PRd55OTVzjhZqSRwS/P9SeRHdfQ8F0pkgHpRfoG/6aSLoEo1r/2Pp 2Kbg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207si7740476pfu.258.2019.07.04.22.30.43; Thu, 04 Jul 2019 22:30:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727548AbfGEF3x (ORCPT + 99 others); Fri, 5 Jul 2019 01:29:53 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:39947 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbfGEF3x (ORCPT ); Fri, 5 Jul 2019 01:29:53 -0400 X-IronPort-AV: E=Sophos;i="5.63,453,1557180000"; d="scan'208";a="312496483" Received: from abo-12-105-68.mrs.modulonet.fr (HELO hadrien) ([85.68.105.12]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 07:29:49 +0200 Date: Fri, 5 Jul 2019 07:29:49 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: wen.yang99@zte.com.cn cc: Markus.Elfring@web.de, linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn, Gilles Muller , nicolas.palix@imag.fr, michal.lkml@markovi.net, yamada.masahiro@socionext.com, cocci@systeme.lip6.fr Subject: Re: [PATCH v2] coccinelle: semantic code search for missingof_node_put In-Reply-To: <201907041103003504524@zte.com.cn> Message-ID: References: 1561690732-20694-1-git-send-email-wen.yang99@zte.com.cn,904b9362-cd01-ffc9-600b-0c48848617a0@web.de,alpine.DEB.2.21.1906281304470.2538@hadrien <201907041103003504524@zte.com.cn> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1407068154-1562304590=:18245" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1407068154-1562304590=:18245 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Thu, 4 Jul 2019, wen.yang99@zte.com.cn wrote: > > > > +x = @p1\(of_find_all_nodes\| > > > > > > I would find this SmPL disjunction easier to read without the usage > > > of extra backslashes. > > > > > > +x = > > > +(of_… > > > +|of_… > > > +)@p1(...); > > > > Did you actually test this? I doubt that a position metavariable can be > > put on a ) of a disjunction. > > > > > > +| > > > > +return x; > > > > +| > > > > +return of_fwnode_handle(x); > > > > > > Can a nested SmPL disjunction be helpful at such places? > > > > > > +|return > > > +(x > > > +|of_fwnode_handle(x) > > > +); > > > > The original code is much more readable. The internal representation will > > be the same. > > > > > > + when != v4l2_async_notifier_add_fwnode_subdev(<...x...>) > > > > > > Would the specification variant “<+... x ...+>” be relevant > > > for the parameter selection? > > > > I'm indeed quite surprised that <...x...> would be accepted by the parser.. > > Hi julia, > > Thank you for your comments. > We tested and found that both <...x...> and <+... x ...+> variants work fine. > We use <... x ...> instead of <+... x ...+> here to eliminate the following false positives: > > ./drivers/media/platform/qcom/camss/camss.c:504:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 479, but without a corresponding object release within this function. > > 465 static int camss_of_parse_ports(struct camss *camss) > 466 { > ... > 479 remote = of_graph_get_remote_port_parent(node); > ... > 486 asd = v4l2_async_notifier_add_fwnode_subdev( > 487 &camss->notifier, of_fwnode_handle(remote), ---> v4l2_async_notifier_add_fwnode_subdev will pass remote to camss->notifier. > 488 sizeof(*csd)); > ... > 504 return num_subdevs; I suspect that what is happening is that there is a runtime error, but that error is caught somewhere and you don't see it. Could you send me again the entire semantic patch so I can check on this? I think that what you want is: when != v4l2_async_notifier_add_fwnode_subdev(...,<+...x...+>,...) ie x occurring somewhere within some argument. julia --8323329-1407068154-1562304590=:18245--