Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp396495imn; Fri, 29 Jul 2022 10:08:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vOgENPFunbQSHFkGFV8ABumiQZsdHEkYXr1aKEhmAPIv4QBYmda4yWvZoa2ci9rT5KIrUR X-Received: by 2002:a05:6402:5516:b0:43a:42f9:24d6 with SMTP id fi22-20020a056402551600b0043a42f924d6mr4610366edb.204.1659114532489; Fri, 29 Jul 2022 10:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659114532; cv=none; d=google.com; s=arc-20160816; b=lAvHzGzuH0rD/oohwSWhNbCaWdTYhvA/AV/9Zb4/9Jx29qJDc0kH4bxnqcCP+Kr/7d B75bTJOwlb/yspAjnXW/Zg28wGIIiAO1yRNSNkVIIR54n7I0HlqZtphDbkm0Mjfc03+S /yAfq9tvfTParvQFWQ4qt4zp6PSLNMTwmExJsD4yv8VnHWjAZfH3GFjY5rRGY4pJv0g0 5bDLi5npduCXCZb5YId+X4v7cGh0/RB12gMa7G1AuefxHXQlmSuYQG0CLUDWZe56/xRq 3+lA2WvDmOsiVau3MTDskZmtvnDyGj4lolyOXh8Gwgg13vAQqXxXqY2Wbx7lqmHdCKS5 avfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=or3717Nv8YjnSAA2QDoHQCp+pRRAHF0RH/ngfEwGjKQ=; b=OkxLvQAGfDVn75cph7jn81rqW89uQeI/4mm0SJvfB0ZqZihFqoS7Dw0rBANXhwXN6/ LUJD/ERWAw08FGwj6KdE7fR2+YS5gVXpDh6c5HamZ6ivVlibgRzEzrYb9E5/tCaQEL5M q4POI3P1c2GCZXiVslaAovm3qCTfqTkWG+7Q7wt4JhVJR1sByQWoRNqUsb8PRon9R3vM CARr3+yPFdQDHqxdnwrQuSvnGS3n3AfvDI/4+X0ZfIDDEu0XOyazrxW2szz/2BGgeonq cWPeXSCFGSKhOEzLmk7O2RBXbwmLo30NrqvymLBeGzhL2yEdrAuupin6btilcpt8q2x9 4yzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp20-20020a17090793d400b0072edc70dea8si3083246ejc.399.2022.07.29.10.08.27; Fri, 29 Jul 2022 10:08:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237601AbiG2Q5A (ORCPT + 99 others); Fri, 29 Jul 2022 12:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236366AbiG2Q46 (ORCPT ); Fri, 29 Jul 2022 12:56:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30B189A51 for ; Fri, 29 Jul 2022 09:56:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F317B828AB for ; Fri, 29 Jul 2022 16:56:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB712C433D6; Fri, 29 Jul 2022 16:56:54 +0000 (UTC) Date: Fri, 29 Jul 2022 12:56:47 -0400 From: Steven Rostedt To: liqiong Cc: Ingo Molnar , linux-kernel@vger.kernel.org, yuzhe@nfschina.com, renyu@nfschina.com, jiaming@nfschina.com Subject: Re: [PATCH] tracing: Do PTR_ERR() after IS_ERR() Message-ID: <20220729125647.746379e5@rorschach.local.home> In-Reply-To: References: <20220727153519.6697-1-liqiong@nfschina.com> <20220727122847.6b00e29d@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Jul 2022 08:28:08 +0800 liqiong wrote: > It's all right, assign PTR_ERR() to 'ret' anyway. > But this assignment is valid only at the "IS_ERR()" path. > Maybe it is better put "PTR_ERR()" at error path, keep the code clear. No it does not. It adds unnecessary brackets. It is common in the kernel to have: ret = ERROR; if (some_condition()) goto out; ret = ERROR1; if (some_other_condition()) goto out; ret = ERROR2; if (some_new_condition()) goto out; ret = 0; out: return ret; And your change breaks this. -- Steve