Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1867741pxk; Tue, 1 Sep 2020 09:36:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYKadAFXL5KhxW8i97pbsaMYaAPXov61U0CxEkd7awCET2ub+AU5D+JNHERZb4/osnf+vF X-Received: by 2002:a05:6402:17ec:: with SMTP id t12mr2400077edy.328.1598978164631; Tue, 01 Sep 2020 09:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598978164; cv=none; d=google.com; s=arc-20160816; b=p1VpeCpzQYzfMamH6BinfxnHoJ8lyoUK5fGp/kY/6pzKB35qAAF/0j5dfbcH6U+QVT f9mGovACRlY85gekp5A4NnAnbSEmCQ/YcTYiAhJ7/m8I1s9RkBPz39i+9P7QIG9etnCi ZyknMxezLkNDhI1HT+pM7QCQ2Q86SCpVOdUST4YEB6mXHAy5Qc3W5Mt4qxvhMx61ul8h oZ9MThrlIWmiIqTUukUwOt8QzgPLzR/Y7ZXgh8CjgpcL+Z20f/VUZT2VXhzzChmhtnkl rmS+htljv51ix+eAbTuDR+tx1HxM71mpysD6gcPuPax8Pw/EpFs0zC2AMnBw/M1nueOe yTtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=bbNqm54kZFMNalabbjXqdAJd2ZNj4u7Y+FjYV3cXSFA=; b=FAKu4zVPxf6jOvQDMtK3hfE/0eJqBBL8VJdqhtOShKX0fORCNiGNESyC8+fnWjRNco VLxQfvkod4CGtXsFkL3PlmnFn1l+KUxkhBgEpNsP7idlQxpdH0ScWXkUcVUb/HTBNOi2 wPl27v2poYS/RgELnUohM/9PMXP8VX4AZDgGWpKwnET/pBfZjwgj3aL1PuNlewhq/bUr HjPjd90JIk3aywDYpUoOW6ZOo/psDdyAT4YDt5o2YuQSihEXY9fkIIxmv+oVYwbpcuyE UKh5DCr1wwoKkJGDY2OvQbH/wcIBjGLr4PVzdGPsVZg+snSBscEVAVdo5VEc1HeWVtWB egAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sBJjxRcF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si882691edm.126.2020.09.01.09.35.40; Tue, 01 Sep 2020 09:36:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sBJjxRcF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730848AbgIAQed (ORCPT + 99 others); Tue, 1 Sep 2020 12:34:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:33878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730671AbgIAPbK (ORCPT ); Tue, 1 Sep 2020 11:31:10 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B96C21527; Tue, 1 Sep 2020 15:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974269; bh=DcBlB18rbAsmyBD9sb9dDR94iJ5BAmzF5Xo0e4RxksY=; h=From:To:Cc:Subject:Date:From; b=sBJjxRcFa7GzT6SamUEOBeBB4W2Ofp99PojRb8SLlckVfMyokPt9uatH0MnbBHXpD E8Z30W3gjJKJ6u338nbOuu0x4gUCBRo2RSLnm9eEEDESkEIjVomd8K6GYBjLpdEsuM NxbukGKI9+I10NsKUnvx2pFV+yCHg7r7Zm3Assm8= From: Krzysztof Kozlowski To: Greg Kroah-Hartman , Jiri Slaby , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , Paul Cercueil , Lukas Wunner , linux-serial@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/2] serial: 8250: Simplify with dev_err_probe() Date: Tue, 1 Sep 2020 17:30:59 +0200 Message-Id: <20200901153100.18827-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski --- drivers/tty/serial/8250/8250_bcm2835aux.c | 12 +++--------- drivers/tty/serial/8250/8250_ingenic.c | 20 ++++++-------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c index 12d03e678295..fd95860cd661 100644 --- a/drivers/tty/serial/8250/8250_bcm2835aux.c +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c @@ -110,12 +110,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) /* get the clock - this also enables the HW */ data->clk = devm_clk_get(&pdev->dev, NULL); - ret = PTR_ERR_OR_ZERO(data->clk); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "could not get clk: %d\n", ret); - return ret; - } + if (IS_ERR(data->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could not get clk\n"); /* get the interrupt */ ret = platform_get_irq(pdev, 0); @@ -155,9 +151,7 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) /* register the port */ ret = serial8250_register_8250_port(&up); if (ret < 0) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "unable to register 8250 port - %d\n", ret); + dev_err_probe(&pdev->dev, ret, "unable to register 8250 port\n"); goto dis_clk; } data->line = ret; diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c index dde766fa465f..988bf6bcce42 100644 --- a/drivers/tty/serial/8250/8250_ingenic.c +++ b/drivers/tty/serial/8250/8250_ingenic.c @@ -259,22 +259,14 @@ static int ingenic_uart_probe(struct platform_device *pdev) return -ENOMEM; data->clk_module = devm_clk_get(&pdev->dev, "module"); - if (IS_ERR(data->clk_module)) { - err = PTR_ERR(data->clk_module); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, - "unable to get module clock: %d\n", err); - return err; - } + if (IS_ERR(data->clk_module)) + return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_module), + "unable to get module clock\n"); data->clk_baud = devm_clk_get(&pdev->dev, "baud"); - if (IS_ERR(data->clk_baud)) { - err = PTR_ERR(data->clk_baud); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, - "unable to get baud clock: %d\n", err); - return err; - } + if (IS_ERR(data->clk_baud)) + return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_baud), + "unable to get baud clock\n"); err = clk_prepare_enable(data->clk_module); if (err) { -- 2.17.1