Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1816851rwd; Fri, 2 Jun 2023 00:01:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pxxEyoqAp39qQmll+ClZ2D3NWDcjNFP+HRk9adEPH6nXrQpwfrppXulyR5btY0YmAOm+s X-Received: by 2002:ac8:59d4:0:b0:3f6:aa29:b617 with SMTP id f20-20020ac859d4000000b003f6aa29b617mr14820022qtf.15.1685689279917; Fri, 02 Jun 2023 00:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685689279; cv=none; d=google.com; s=arc-20160816; b=JJnD4gZgIPfz0xXu6dL3nm9NeS/xUlv10LqHDgMvHmwYJnLXAZwy52Epz0M+cAxttL owax7YZ1lAticlo3P3JIK6sR2DlNg9+gVOYTdcyzZ6N/OrdEXvCBgF7fGeglBHjop0d+ yho8cQ54pSiG2ToSHhYRl94ILpQGRzUGnmeCE3MJjkmM/beaeKopOa8/5da+nlH7EfXz w/9YdoqHleAT+GRMXepZ52x/GF6lBrxfOoKCzuqEKHtrxqDyhB9yh1TOH7+YDaOibXIu alRA36rugkqDNchJYWCgf1o+YwKkqQq4vg9mgcpJS1riQOT2Wbn0SuWOi8MDJ5a7GGfC ERkw== 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=ahQwTADM9BtMB706JL9R1z1ksz3XAeiVqyC+AR7xNFE=; b=L1Xp6gTb+7H9+at9LArlg+CmTSsYoYFBCbosG30nh2mc5PrH53/wWfIDzf4y9UE92n AJlVeHWNt7d3etmB+4OShpdf9oToO+5ATf8L1npMUE6YZslLJsRSnxZROzwHIjRGcDWp tflwbWrhjwgKjLEjG+143a8njDxpx9g7Kd8Pro6JTuO29MT4vYYnpzovPNafeS16gscx iWvUrgvPjRTCjP57RRfMiCUhYR7x8Hizk+rV+rFmoQWWgbcPL/KmAG5oaqCjV0EgDZtC Kf6s5W2EBVKcM2FyOQ7JDSzzaWB0UqyARwHXi3z1IpnNA1SDXD+S/+40X+JvTuOtS4oV RXpw== 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 az9-20020a056a02004900b0051358b5c88bsi516588pgb.452.2023.06.02.00.00.58; Fri, 02 Jun 2023 00:01:19 -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 S234015AbjFBGq4 (ORCPT + 99 others); Fri, 2 Jun 2023 02:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233473AbjFBGqy (ORCPT ); Fri, 2 Jun 2023 02:46:54 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1EAB6EB; Thu, 1 Jun 2023 23:46:54 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 6478A8111; Fri, 2 Jun 2023 06:46:53 +0000 (UTC) Date: Fri, 2 Jun 2023 09:46:52 +0300 From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Cc: 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: <20230602064652.GF14287@atomide.com> References: <20230602064104.41508-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230602064104.41508-1-tony@atomide.com> 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 * 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. Regards, Tony