Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4397355rdb; Fri, 15 Sep 2023 00:18:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2KsymqciEzyem77TCbLu1//n9SAN07QoAdKg+gBT2Oos7BiNjTm/k6Ty/+lRVkDJB1Lm+ X-Received: by 2002:a05:6358:9306:b0:130:e0a9:a7b4 with SMTP id x6-20020a056358930600b00130e0a9a7b4mr1202020rwa.13.1694762310229; Fri, 15 Sep 2023 00:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694762310; cv=none; d=google.com; s=arc-20160816; b=b6Ti/rH3IUI1Dqpn5ek56z5DvbSmSp0sT6OAkpTiFDd6sZm8fQm/0jnnWTY+E8Zt98 plNtkmzi4vJrMaWxtwH0qnxHNGhCDD2sAxPWP5A1pyMf9QV3iw4m+w3x7ASrTOZ9mxFh Fw2UfSI2pH4DkqXzzmOdu1Rm9OO2dBnrYZA5udwPDcpE7oyFr9GkVu8FAh/ve7fL7/y4 63A+skfgkrT5/BlfFmbeffDpmrGRNjomvngRNvOzEgQ1ZTHQYcf9mBwUKgCiSkCF85dX KgjZbG9SKPCSWgMnlqhHIu1UvjvZhywhSeOTCoC6tWNquUcA/WVH5nQQgJDYdvae9SdU XG/A== 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=tkx5yzqeUSQWOBS/dzsbDPx6R835TL/G0YO4Pze8k+8=; fh=KxrcDdeDPXSz72op7vcJeWRnn7TJlAkBnh8CPcxwAdA=; b=cQPmqciVTSd5TxRGR7NujRqflQAAnAUP7/Zu2vHZB+H0UqCCksqqbGJmWWYy7v8+N5 oSEsj8HSJI7OD/kKoG569wa5P+5fRUF7Yjm1uOdk8UK11sHEc39zV68nmtpTfvVzdtLV 99vxAYd+UGdG34a6Ba17nn5mAKVY9SwDMRBAGNwZwFWlBbd44ICa1bliUFpTNgQzUytU u5yk01tuvQF7q5NPHSDIs/xR5I1G85SdWQpKwyz+RglIjZtNvj8OScXtuhNEbgZicBPU l/RwNqN/6KThoi8LKv3QPWUCyn/7qWd1mCx/1K8w0TB6qtOHnVJocaWNvnJf8Bg1U5pw ohmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u1-20020a637901000000b0057414fa789fsi2776246pgc.503.2023.09.15.00.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 00:18:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 58E028067A87; Fri, 15 Sep 2023 00:12:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232666AbjIOHMp (ORCPT + 99 others); Fri, 15 Sep 2023 03:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232570AbjIOHMn (ORCPT ); Fri, 15 Sep 2023 03:12:43 -0400 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10AA5A1; Fri, 15 Sep 2023 00:12:34 -0700 (PDT) Received: from localhost (unknown [124.16.138.129]) by APP-05 (Coremail) with SMTP id zQCowABnb1fBAwRlf4YUDQ--.60186S2; Fri, 15 Sep 2023 15:12:01 +0800 (CST) From: Chen Ni To: ychuang3@nuvoton.com, schung@nuvoton.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Chen Ni Subject: [PATCH] tty: serial: ma35d1_serial: Add missing check for ioremap Date: Fri, 15 Sep 2023 07:11:06 +0000 Message-Id: <20230915071106.3347-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowABnb1fBAwRlf4YUDQ--.60186S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Xw4Utr48Aw13uw4UXryrWFg_yoWfWrb_CF 95W3yIqr409rs0kw1Sqry5uryftryqvF4kXF10v3sIkr98AaykWFWjvr1vyr47uw43WFy5 tr47KryfAw1qqjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbcxFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVWxJr 0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK67AK6r4x MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr 0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0E wIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJV W8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAI cVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VU10tC7UUUUU== X-Originating-IP: [124.16.138.129] X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 00:12:43 -0700 (PDT) Add check for ioremap() and return the error if it fails in order to guarantee the success of ioremap(). Fixes: 930cbf92db01 ("tty: serial: Add Nuvoton ma35d1 serial driver support") Signed-off-by: Chen Ni --- drivers/tty/serial/ma35d1_serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c index 465b1def9e11..4a9d1252de35 100644 --- a/drivers/tty/serial/ma35d1_serial.c +++ b/drivers/tty/serial/ma35d1_serial.c @@ -695,6 +695,9 @@ static int ma35d1serial_probe(struct platform_device *pdev) up->port.iobase = res_mem->start; up->port.membase = ioremap(up->port.iobase, MA35_UART_REG_SIZE); + if (!up->port.membase) + return -ENOMEM; + up->port.ops = &ma35d1serial_ops; spin_lock_init(&up->port.lock); -- 2.25.1