From patchwork Wed Sep 2 15:06:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 254850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B437C433E7 for ; Wed, 2 Sep 2020 15:07:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CB8720773 for ; Wed, 2 Sep 2020 15:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599059279; bh=vbd2YXuxT3Yz0bN8TyD3EQNRyFzd8vDK7+rMFiJqG1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iEdhxOR/YUbCYE+rPkIHp7NiFRRrFCpxvR+GppVA9u5/JndhlfAITcwZk2i8dD9lW USdEougZUtgA5WCTVtJxq9Y+q7pxR1NjoMC6tyV6c7Nd7y5WhedNLczZqhhJ6s8I7a FQiQdLYq94HMvVyzc6Q+9SAWehQ4+K/wqnSVit5A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728037AbgIBPHk (ORCPT ); Wed, 2 Sep 2020 11:07:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:44520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728024AbgIBPHg (ORCPT ); Wed, 2 Sep 2020 11:07:36 -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 633F820C56; Wed, 2 Sep 2020 15:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599059255; bh=vbd2YXuxT3Yz0bN8TyD3EQNRyFzd8vDK7+rMFiJqG1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hy3og9qqM244W8aAlhguKZcUJLSzQTrmUOeMNNERCciEGkkxdYFb839A0Amltm6Mj DToDym2tHVkCaux31y2sDdPOW/2c6RQWYH1y+jH302VejAxbuUtX8HxkUbknwIoRp0 Dlmrfv7ILBMVC71RjA7CHlhkFzZbIyt3ffLBQc1I= From: Krzysztof Kozlowski To: Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Michal Simek , Sekhar Nori , Bartosz Golaszewski , Oleksij Rempel , Pengutronix Kernel Team , Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team , Heiko Stuebner , Pierre-Yves MORDRET , Maxime Coquelin , Alexandre Torgue , Peter Rosin , Wolfram Sang , linux-i2c@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Cc: Krzysztof Kozlowski Subject: [PATCH 8/9] i2c: mux: gpmux: Simplify with dev_err_probe() Date: Wed, 2 Sep 2020 17:06:42 +0200 Message-Id: <20200902150643.14839-8-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200902150643.14839-1-krzk@kernel.org> References: <20200902150643.14839-1-krzk@kernel.org> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@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/i2c/muxes/i2c-mux-gpmux.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c index f830535cff12..d3acd8d66c32 100644 --- a/drivers/i2c/muxes/i2c-mux-gpmux.c +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -85,18 +85,14 @@ static int i2c_mux_probe(struct platform_device *pdev) return -ENOMEM; mux->control = devm_mux_control_get(dev, NULL); - if (IS_ERR(mux->control)) { - if (PTR_ERR(mux->control) != -EPROBE_DEFER) - dev_err(dev, "failed to get control-mux\n"); - return PTR_ERR(mux->control); - } + if (IS_ERR(mux->control)) + return dev_err_probe(dev, PTR_ERR(mux->control), + "failed to get control-mux\n"); parent = mux_parent_adapter(dev); - if (IS_ERR(parent)) { - if (PTR_ERR(parent) != -EPROBE_DEFER) - dev_err(dev, "failed to get i2c-parent adapter\n"); - return PTR_ERR(parent); - } + if (IS_ERR(parent)) + return dev_err_probe(dev, PTR_ERR(parent), + "failed to get i2c-parent adapter\n"); children = of_get_child_count(np);