From patchwork Fri Jun 2 06:41:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 102330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp837582vqr; Thu, 1 Jun 2023 23:55:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4DIoJ3yWuiYXUCpRrLkv6s0V1/uyjWtSN/JB2H/g5V4mkUFDIXah0X/tRXxACBupb43i2w X-Received: by 2002:a05:620a:27cd:b0:75b:23a0:de9f with SMTP id i13-20020a05620a27cd00b0075b23a0de9fmr12320081qkp.29.1685688912930; Thu, 01 Jun 2023 23:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685688912; cv=none; d=google.com; s=arc-20160816; b=CuY2hC4AWDYmXvFE8sfsU6+UyyCrOxqVSe3x4ovAZq7i+HWDHcev7AcSiKRuycqpqM /xagoShDBUuySmsoroJ7jkG5oWCtaG2Ik08onpViL7jfaDNG0KKHFwthsejoO2JBem7k 5wJNWeu/0GMm9kTw5RtLH7dAEpmodEiduiwWjDp8IHauZevUNqoqNsLVsUfCDVfAD4d/ FHrKmIPtKQ76NX91XG3S4EJPJmQGQPMccH0FfBTXeWB58XKsrmVhnnDgrxmM41zkCS2m 2WvDo8Q6MKpECfYyrxyu0ANCcptMp4YPaVSoA2As3AOJ65Z9b8OS6T7nNUCBuF6IghmA 2MCA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a637316000000b00534897b70f9si549806pgc.29.2023.06.01.23.54.58; Thu, 01 Jun 2023 23:55:12 -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 S233753AbjFBGlO (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_J=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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767572937118139230?= X-GMAIL-MSGID: =?utf-8?q?1767572937118139230?= 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; }