Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1839538rwd; Fri, 2 Jun 2023 00:27:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WF/GROJymbAlTnCzSQnA5rd06VIlBAtJDueC4f8YzavgLL9aIxjaF8vezIqHCm2Rb/4GS X-Received: by 2002:a0d:db51:0:b0:568:bbbf:c29a with SMTP id d78-20020a0ddb51000000b00568bbbfc29amr12962326ywe.19.1685690820633; Fri, 02 Jun 2023 00:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685690820; cv=none; d=google.com; s=arc-20160816; b=oQa39H/1S5rFV+Hf/ThU0EjqIBRfOiT3Dxc13s+bPGv2z+JzsFlmnNMDhnCq9HcAVf +q+ZHH9x0bPhyiwi4Qgy/RNB8XnXCS722uyYcwaxpVtdR4D3hJFwdn+NZJVi0UicjHH1 JVwzA+4kXU2+xmzLvOI6rtedG4FMD9QziIhj1hnQRuCAd1nCTYkSFkQnc/q5pkkfuUwW sePXgn0M3pEKbQpBUsvYrNXSNh+krHVwXQqiMAj8g+DoqjfrTWZAn3OZ/2+wWHP4IDm/ yKHe5XV+t1XwxUXGX2kha7gsII8e4nEuJLzC9sj8K5ETdWsIR1peOgM0aAcLwdwD1VbM YLOg== 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 :message-id:date:subject:cc:to:from; bh=DjC7t2J8Ew6YJjFs5z4OnMHBWSSVMpKe9WNYkSyJr1I=; b=rxGqyl8XUw1XiInNlETnH1eT4oyHLbs3z90Q/viN/HSzAwBc4qOxh5SOYbYkgsUtYA kLGGrDmCA5XUUgVQFRiSxkaz7yDOxZioe19B9+DX/+hJtBxri6C8YYYkalktPVdsX6uM 6dpTRFr6dVDeplUoi7GHLvL02DS997H7U1ddN3h/QWaUOOalcoPJPMPFkjkn71E864lt tY/QqGJgGEaKTQyCHfOnL+ZtFZa7nnV58PmloA0TjlJWRthPX8MhDfHHauVrz25k4ENa X+SilkUdRUXA8qReEraVswPU3N5OaKXWc1QWUc70DaRCfPSb5WQ3qiYkkWqatmdyUq4C uiZg== 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 y11-20020aa79aeb000000b00643a730d50bsi247716pfp.389.2023.06.02.00.26.48; Fri, 02 Jun 2023 00:27:00 -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 S233894AbjFBHAP (ORCPT + 99 others); Fri, 2 Jun 2023 03:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233391AbjFBHAN (ORCPT ); Fri, 2 Jun 2023 03:00:13 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5584813D; Fri, 2 Jun 2023 00:00:12 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id E491D8111; Fri, 2 Jun 2023 07:00:09 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , 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: [PATCH v2 1/1] serial: core: Fix error handling for serial_core_ctrl_device_add() Date: Fri, 2 Jun 2023 10:00:05 +0300 Message-ID: <20230602070007.59268-1-tony@atomide.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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. 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