From nobody Wed Apr 8 04:58:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 571FDECAAA1 for ; Sun, 23 Oct 2022 06:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbiJWGvx (ORCPT ); Sun, 23 Oct 2022 02:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbiJWGvr (ORCPT ); Sun, 23 Oct 2022 02:51:47 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA91876964; Sat, 22 Oct 2022 23:51:45 -0700 (PDT) Received: from kwepemi500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mw84j1Hf4zHv3l; Sun, 23 Oct 2022 14:51:33 +0800 (CST) Received: from huawei.com (10.175.103.91) by kwepemi500024.china.huawei.com (7.221.188.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 23 Oct 2022 14:51:42 +0800 From: Zeng Heng To: , , , , , , , , , , CC: , , , , Subject: [PATCH] serial: 8250_bcm2835aux: return PTR_ERR when fail to acquire clk Date: Sun, 23 Oct 2022 14:50:53 +0800 Message-ID: <20221023065053.4057108-1-zengheng4@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500024.china.huawei.com (7.221.188.100) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add error handling process when fail to acquire clk by `devm_clk_get_optional`. Signed-off-by: Zeng Heng --- drivers/tty/serial/8250/8250_bcm2835aux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial= /8250/8250_bcm2835aux.c index 15a2387a5b25..1c623e93232c 100644 --- a/drivers/tty/serial/8250/8250_bcm2835aux.c +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c @@ -119,6 +119,8 @@ static int bcm2835aux_serial_probe(struct platform_devi= ce *pdev) =20 /* get the clock - this also enables the HW */ data->clk =3D devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(data->clk)) + return PTR_ERR(data->clk); =20 /* get the interrupt */ ret =3D platform_get_irq(pdev, 0); --=20 2.25.1