Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1813874rwd; Thu, 1 Jun 2023 23:58:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73/KrvO5o8nIw/J3Rz6W9A5HjIx1d9MzrVf4N+dP8lQgBJSApNIHHV9Z6Eb3288kfoAUTO X-Received: by 2002:a05:6830:1e79:b0:6b0:c4be:6549 with SMTP id m25-20020a0568301e7900b006b0c4be6549mr1588932otr.9.1685689098432; Thu, 01 Jun 2023 23:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685689098; cv=none; d=google.com; s=arc-20160816; b=IGBAxfElmcMI03HKFu05m8t1SmeYeVvQJ0ATUhE48wtDKr1+qPH8LDj0ZoK09xPpyr TufiV/OTI7ZKjk9VqfiIKYYDMv/dLjATjgy8vzT4dWWKQYdLL9YzYiHYB2+OUxjokHFg +Dz4ahYLfgY0QAKjmtacdFCQibz/9C1ctOCet581mCINmG9RUYH+BjTeX6gQOpg6I61E UycCNX1vuo30NmDOKTy262mn02KQBQGhiAOZWLN5G0KCDznHTIoCUDxjtbN+cWc9kdSQ qWBomjwUxsv5So/O6xIM0Fn/FCOZU4wkenFBHngWoNjnWnHLJZ6CotMWaHH60vett9/O Y5IQ== 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=H9qQuZW9HEP/We4TBwXUEt0k9XHWDQTNX3/+6HRHjFI=; b=O90IeOoAvvFj9Rh/ad7EUDhG78u49TzHoaK9oZv2j5sSV5glBnP8u0cOKXTH4u4MtD ilL7CmFwL24hWSirnMP2nQT5WioVXhH2NJbAwEhWVg0KxI943YXAin2UosnuZcjZkksE OLA0StqUXwJ2Lc3SafMF8kDNo5di0pF56iA4JD6VfjcLWVzfisHmDixfN9Czmyadfyit lLf0KrU3x0WRsGODJYUkFAL4QoLUl+voQj+qOM6SN9TyMEmUmxmwEjTr79g0f4vL6wSd kxIexZOU91uTORAQl9ZrKh9Wzs1TMpdqha1PpqpZ44jHR+w/311MECB6hLT8m+yGgsNU Gx1Q== 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 d16-20020aa797b0000000b006489d6fa83fsi276628pfq.142.2023.06.01.23.58.01; Thu, 01 Jun 2023 23:58:18 -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 S233709AbjFBGlO (ORCPT + 99 others); Fri, 2 Jun 2023 02:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjFBGlN (ORCPT ); Fri, 2 Jun 2023 02:41:13 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 556CAEB; Thu, 1 Jun 2023 23:41:12 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 5407D8111; Fri, 2 Jun 2023 06:41: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] serial: core: Fix error handling for serial_core_ctrl_device_add() Date: Fri, 2 Jun 2023 09:41:02 +0300 Message-ID: <20230602064104.41508-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 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; } -- 2.41.0