Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1818515rwd; Fri, 2 Jun 2023 00:02:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7il4mLQ/Sbbj/lVe6qsRRdBY43b1m98WuxDRfSoeLlXVa1RaHexIJa2qlemDqNWj+2uKUH X-Received: by 2002:a05:6358:788:b0:125:83a6:caa5 with SMTP id n8-20020a056358078800b0012583a6caa5mr10508725rwj.3.1685689364879; Fri, 02 Jun 2023 00:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685689364; cv=none; d=google.com; s=arc-20160816; b=qn/r9RJXMsLJotA3gTeUIpx8zcr6hLmp3umhAhA1rFxWImE7CO03n5itOet4YuQj5Y g+1iagIepQUyietTzdo0jLpDGsbEZ/znNslqzfQm0CAEIO7lGwH4523DXxVf2zoyUzc9 U9XLYxVbDynTCckPTytkQPWy7UWrVIcf9j6IOj7sW+4mqqvGP9C6lonBmTpdAGxOnAAA qAl8DsZL1dYHiXa7a+zt7Krb7mwGCsZXFBdiOBC9K38z3Rbbs6BD79YNN1HYTn+vFy4g tTF99i8NZUXjR3RHvjUaVOos0SgjElXekz9Zj7DLI9rV4hoSRJR6TKxy6OLyuIi5+Yqh RRNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OLkEHLgH8EP6E00O7A5Q+DYTcaFL/3G7LTRGJmwN7Mk=; b=axjBfLXw/gH1aVROG7y44uE1LPew68kJnEVQmi/ZnTByibZRVK+5V4ekZD+7gv7jnA aADpGTArAiRsG6A7AxP41Bh+mXN7SGGehL5ZnX7G0ygdTmosJsVnyK+Nai+DC6Bxt7Ey 3uz0XGR2KYODJjryxQhaVsHfblVr3YroqHue3QQAAW0Q+NHcKfnBDSY+MHrQUqbbX/hl 2oIDMrqxFAnTA580xri/uvMzSpMX6rRV5aD5txPMjxDrkO4kaEznHznWBfObYpPQ5ke8 6Cn3Yt6TbZEO153+vMeSPXAKlb5yeOG/dxEmE9UL8iSiWrsUFyJOpyZBzYkHwqTtGCM0 Kj/A== 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 n1-20020a17090a4e0100b0025638cb2d67si2302737pjh.51.2023.06.02.00.02.11; Fri, 02 Jun 2023 00:02:44 -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 S233920AbjFBGvI (ORCPT + 99 others); Fri, 2 Jun 2023 02:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233850AbjFBGvE (ORCPT ); Fri, 2 Jun 2023 02:51:04 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5FA1AEB; Thu, 1 Jun 2023 23:51:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id C816D8111; Fri, 2 Jun 2023 06:51:02 +0000 (UTC) Date: Fri, 2 Jun 2023 09:51:01 +0300 From: Tony Lindgren To: Jiri Slaby Cc: Greg Kroah-Hartman , Andy Shevchenko , Andy Shevchenko , Dhruva Gole , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-omap@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: core: Fix error handling for serial_core_ctrl_device_add() Message-ID: <20230602065101.GG14287@atomide.com> References: <20230602064104.41508-1-tony@atomide.com> <20230602064652.GF14287@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 * Jiri Slaby [230602 06:48]: > On 02. 06. 23, 8:46, Tony Lindgren wrote: > > * Tony Lindgren [230602 06:41]: > > > Checking for NULL is not enough as serial_base_ctrl_add() uses ERR_PTR(). > > > > > > Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") > > > Signed-off-by: Tony Lindgren > > > --- > > > drivers/tty/serial/serial_core.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > > > --- a/drivers/tty/serial/serial_core.c > > > +++ b/drivers/tty/serial/serial_core.c > > > @@ -3342,7 +3342,7 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port) > > > ctrl_dev = serial_core_ctrl_find(drv, port->dev, port->ctrl_id); > > > if (!ctrl_dev) { > > > new_ctrl_dev = serial_core_ctrl_device_add(port); > > > - if (!new_ctrl_dev) { > > > + if (IS_ERR_OR_NULL(new_ctrl_dev)) { > > > ret = -ENODEV; > > > goto err_unlock; > > > } > > > > Hmm actually we should also change to use ret = PTR_ERR(new_ctrl_dev) here > > instead of translating all the errors to -ENODEV. Will send out v2 version. > > Why OR_NULL at all, actually? Yup there should be no need for that thanks. Regards, Tony