Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2350763rwd; Fri, 2 Jun 2023 08:15:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pPJoCGCzB51UtJaSuJGRxdeDj/uia1NdVb4J49eHo2/m0i/1SFFREdcZTNHPc/cKJE6Ps X-Received: by 2002:a05:6a21:7889:b0:100:6863:8be7 with SMTP id bf9-20020a056a21788900b0010068638be7mr9143405pzc.62.1685718935130; Fri, 02 Jun 2023 08:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685718935; cv=none; d=google.com; s=arc-20160816; b=axwUGl/5dpjxXnHRiyQgxiklDP54KI/W0u2qENRV/NP9b1vgugEDAq67pAwdqBb5qb WNAR+Sfym9uQvhdaFEwSzz5YV6DtnAm84NUHe+fKX6fL1RbOr/NHF0rKHDMtV7SJ6xS7 jeHod0qK3jq1YHTyfBU+CPpUV4YePWeWXkDKEBdMdULoHq0x2dzY77h4zrriDrE0zLNo z0REwyUN/cq02S6wbwm7UXxD24wi2aXGNLC/jSTr4hPjn6YCSeGhrHsOv8fTvmGDJjWM matUA1/ytp8s5+PRyFQMWUdHtguW0n52AMSXD1hyIf/JVL8XBmKlb60Qo0QfX2eED46J h8fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=njE0zBzKPqra+aiyrXmqnlF13u+EWefRi2Do/g//8Nk=; b=TgIswEtSdcd5AlbVIfBEFw1c6od1bAVwaWvvoNIp2HpBVE19uH6kRvPvGVXXef89kc Lzwb21IlvYTIO3rviJJCWbllEU7HEvEra40tudT6DtNS7v+mkto1xD5qlVyysbHgDPKP 2DPapfomH5g9iqfzXUQXGtOCJhiNcY7PET4x8aJZvBeXGgNjO2ATQX1AkI0Z+WGvqgFH 1BTkPvm0l1AQm10Nf13ZEJ9KvC2I0MH0wTMOYJWbNFwKyecrSfm+7Q3WG11rVnkI6fKc eyAuxjvXWWm9SNS6/kCQjS5bWSrxa0DAXi8vvROQKUzfLxc3lLgVld+ZYGt5wYvudAO9 1bjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bakh7aT7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a636b05000000b0053f26705a1csi1141288pgc.172.2023.06.02.08.15.21; Fri, 02 Jun 2023 08:15:35 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=bakh7aT7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236280AbjFBOyf (ORCPT + 99 others); Fri, 2 Jun 2023 10:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236262AbjFBOyV (ORCPT ); Fri, 2 Jun 2023 10:54:21 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE75EE62; Fri, 2 Jun 2023 07:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685717651; x=1717253651; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=y53sMR24ZEtw6YFFN78RDscItf1umgQZI1yJzYfS/mw=; b=bakh7aT704hmVD+Z3xH06MmXIoCi5ymcCPhHrbySd5Md7a6CkEqZJ2Xp gl+mFljgWYZJxv45RjnMkE94pRuNBqttzyz9XduHKNZWI3PTrEtpO+ctq GW8vFQUkhqrh8qQJpKWrBZ0fjpGWC45ZpJ5OrJHGqn9tAMa8o/JoOtg1d 1BsKIuvnYE4TE+I84U6sHMmBmcYR9ulr8zvGSxwHD1kODzwFytPQt+7pl W3UysjKNFfSgEm1VB8HbBDc0B4fb8iaifZTvpKwKAoYmu4SwdzXKFuQ1T ++xNMLXYZaN3fd1UfRnHSDEfaWL1M+HkYnwQihCeGvfYvzzoZW9Jg/Sxm w==; X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="335500572" X-IronPort-AV: E=Sophos;i="6.00,213,1681196400"; d="scan'208";a="335500572" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2023 07:53:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10729"; a="658297330" X-IronPort-AV: E=Sophos;i="6.00,213,1681196400"; d="scan'208";a="658297330" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 02 Jun 2023 07:53:53 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1q56A3-000fU6-1I; Fri, 02 Jun 2023 17:53:51 +0300 Date: Fri, 2 Jun 2023 17:53:51 +0300 From: Andy Shevchenko To: Tony Lindgren Cc: Greg Kroah-Hartman , Jiri Slaby , Dhruva Gole , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , 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 v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add() Message-ID: References: <20230602070007.59268-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230602070007.59268-1-tony@atomide.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Fri, Jun 02, 2023 at 10:00:05AM +0300, Tony Lindgren wrote: > Checking for NULL is incorrect as serial_base_ctrl_add() uses ERR_PTR(). > > Let's also pass any returned error along, there's no reason to translate > all errors to -ENODEV. Jiri already asked the same question I have had on a glance, and this all solved here, so Reviewed-by: Andy Shevchenko > Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") > Signed-off-by: Tony Lindgren > --- > > Changes since v1: > > - Stop translating all errors to -ENODEV > > - There's no need to use IS_ERR_OR_NULL() as noted by Jiri > > --- > drivers/tty/serial/serial_core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > 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,8 +3342,8 @@ 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) { > - ret = -ENODEV; > + if (IS_ERR(new_ctrl_dev)) { > + ret = PTR_ERR(new_ctrl_dev); > goto err_unlock; > } > ctrl_dev = new_ctrl_dev; > -- > 2.41.0 -- With Best Regards, Andy Shevchenko