Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1218984pxb; Fri, 6 Nov 2020 04:16:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZk9LCyBc2pWLxWtF7DukHMDq7MwJ9/JS7dZtrHIfCjOGlqREHiwdwW0qqvQvS8VF6wRFl X-Received: by 2002:aa7:c7cf:: with SMTP id o15mr1604181eds.15.1604664984199; Fri, 06 Nov 2020 04:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604664984; cv=none; d=google.com; s=arc-20160816; b=iisvOchfZlRHqixLoAeNxgQ6YfktvC8ijhX/7IXwoThNxLwo/qiCGC0pB+pn80MQf1 ZGrtKCRG9J4HzBqd0LOwNfkQsSLBcMLiFQwLaxNNAvP54AOxDU0cHaq1SvfvDAjbh2Yx rQSWQcFNNvK7ss9stMQOJzeKxUWJmY9LXaVrvvNMkneOpbxd5mXfP371kB3LNJSogNQN ne329W2o+g/bxyzqC6ZEN7fCmw4SLhal2Aen3PBXtocSoNQYKITnEkTTqm+Cmq0fzpWc ir+drxcdsabP+ZnADCVToTBjpAmest8FvBJcuSoj3cfM6+aIy+GrSfOBsm8r2bJM/FqX LXcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MEZHhjjXfzkl4BNB/ROK+j03apdy7d6jdbzj8RA5IJw=; b=f6WKLv2cg6+8kRNUsI+lrnVvmuUpQ5oUu/KbOHk91aDmxieGR60KwNh0OcUL909LvS 91PcR2woi+2rduHxTe75WdGXmIAQ4/0IQDt0NHmG0xM+6L9XcrAyMylXk9Z+zgTUJxNV n9+k8Q/jYQdRj9XDXCMiGgiNnjrg7s6Ean8vxMul7lL39lfRQWasO96ofab9/uXHFJNQ Cy/cdsHq5PEd6UlxJNP4jYBrM/bPz7b0KnAAHelO1n/fF2DbmKxKc2s3VyQRjlyGRaJd L7SK6GIk6NxEV+cprhG+rCzl4H8QK7tijRfIBsHSyiChBFfQaHelE9y6h/d+BkU/trrJ 6ZaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pv6U9ZZ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si708654ejv.205.2020.11.06.04.16.01; Fri, 06 Nov 2020 04:16:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pv6U9ZZ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727291AbgKFMLd (ORCPT + 99 others); Fri, 6 Nov 2020 07:11:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:54900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbgKFMLd (ORCPT ); Fri, 6 Nov 2020 07:11:33 -0500 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A2E32100A; Fri, 6 Nov 2020 12:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604664692; bh=uEOhfTfCBXqrs13X3avrkvywnW2eWiyf1LB3yk8KXlE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pv6U9ZZ7FthqDuJGcOYZ3uv+NlHL7YPJjaJly0QyPBb+CvohysudBdVK/3dVc7eiy 1DDVZJ8uqTHjuJNySIwJUf8zYTYE4OFMxVwqBjvlzfl9cjk6ljfMGZ+vYNJvWGUsTb unVEBtel6WTxhRmHpw1ZFIvjzszjPgofJAxipo+A= Received: by mail-wm1-f52.google.com with SMTP id s13so1119853wmh.4; Fri, 06 Nov 2020 04:11:32 -0800 (PST) X-Gm-Message-State: AOAM532OzHlTPfLMLrCPzsZyHkU8ehV7xK3bGwe9dpdeBHhuvAy3Eo2C 4RwuCiUZduEUzoRxOEOwFA1RHCRwUzyqJI6dJ5M= X-Received: by 2002:a05:600c:256:: with SMTP id 22mr2121841wmj.120.1604664689730; Fri, 06 Nov 2020 04:11:29 -0800 (PST) MIME-Version: 1.0 References: <1604649411-24886-1-git-send-email-wangqing@vivo.com> In-Reply-To: From: Arnd Bergmann Date: Fri, 6 Nov 2020 13:11:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] net/ethernet: update ret when ptp_clock is ERROR To: Grygorii Strashko Cc: Wang Qing , "David S. Miller" , Jakub Kicinski , Samuel Zou , Kurt Kanzenbach , Richard Cochran , Networking , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 6, 2020 at 12:35 PM Grygorii Strashko wrote: > On 06/11/2020 09:56, Wang Qing wrote: > > +++ b/drivers/net/ethernet/ti/am65-cpts.c > > @@ -1001,8 +1001,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs, > > there is > cpts->ptp_clock = ptp_clock_register(&cpts->ptp_info, cpts->dev); > > > > if (IS_ERR_OR_NULL(cpts->ptp_clock)) { > > And ptp_clock_register() can return NULL only if PTP support is disabled. > In which case, we should not even get here. > > So, I'd propose to s/IS_ERR_OR_NULL/IS_ERR above, > and just assign ret = PTR_ERR(cpts->ptp_clock) here. Right, using IS_ERR_OR_NULL() is almost ever a mistake, either from misunderstanding the interface, or from a badly designed interface that needs to be changed. Arnd