Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp181210pxa; Wed, 26 Aug 2020 07:55:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt1s0PMlJXzksIKj2gE9XECRGgizU2T2yUmb1bz009AjAbRG4qoItGAKiHdA3Afs/ipBxs X-Received: by 2002:a17:906:3417:: with SMTP id c23mr16033442ejb.45.1598453735308; Wed, 26 Aug 2020 07:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598453735; cv=none; d=google.com; s=arc-20160816; b=jUqe5IKpEj9hp0NQ9YlraNwWzlQ+zv4s2B2MgNsfxmDyDfHdW+JeQVjPprlv6jdWpz BY0eqO74P9nSyT1X8bMMz+uz5mhdQ1BVfkhflS3pJuJDUeQGHX1j5xcRzVxuT1WvTEd+ uRFXHaiDxvjjnPiUkOk0npWgopSR7f2jgSF8xgV7yuS361ZLd0iTdZ45FX0kkflw21Rw sNX7FHNvs4iYhUfrUcOWxaU/89gAmh0mE/Spv11M8QBQC1udBd52BvX7koW1BrkRYHPO oyEjdNn14lkImHJqxmvrPYEhxWKHPM0sbekhnCz8CgiNVGUgC5eV2azMaBB7PMX5zqUC VwSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=65LwSDsbVRrnHT4boryZGcGzfgJVnPr8SUWO4niX+ig=; b=JLlQcLcRsNP3Zay85lJG0w/64Pw67X/wvESeW89BKXCZL3WWlHxjQC7MEcmysqzyXN TrbObnXb25J3b40Z5oYRcpEiZW+3hCKM/KRv41kuzmgv7p3MpeWEJt/0zC6+nqBdlFXB OP6ngHkmtjnJyUhrnX0Fad2lDko5mQBleSyH1/x7tGmovdJ3SNC5fzYv2t7RfNB5TfUi QTV7lweVs28E6Mt+ELoOYMhuo5bxztwWe/0zU7HDIY0Ahs2xY1f1G8Cbcf4g4tuovtRE ziRCjbVEwWQ9HYeKYdxE857Q81raosJhT175lY3eSMoWJr60yTRoUGoAGPOwNK0anVzQ MCpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qMZgura2; 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 v26si1710815ejr.257.2020.08.26.07.55.12; Wed, 26 Aug 2020 07:55:35 -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=qMZgura2; 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 S1728271AbgHZOxg (ORCPT + 99 others); Wed, 26 Aug 2020 10:53:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:40306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728209AbgHZOxP (ORCPT ); Wed, 26 Aug 2020 10:53:15 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (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 86DCB2177B; Wed, 26 Aug 2020 14:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453594; bh=Qo3LbyvmpBGQKG4D/yZypYAesoTm5jVx4P7R/QfNlcY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qMZgura2EYsW2bxG0xHLWT3v4KZYKNJn4qop8HRQH5iq+4faVf9nQrwTotbcbEPkY MZsl9iKjz8CrXVxC2l/VPlpgA+2HXRrHV7Y8WdFm9cVVtqlF94M9CeMdr1QLXcUsso byEgtFP2Z/C+qUUmdT2VClwjlQ5CO1F4n3kxGbIo= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Jonathan Bakker , Alexandru Ardelean , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 13/16] iio: imu: inv_mpu6050: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:51:50 +0200 Message-Id: <20200826145153.10444-13-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826145153.10444-1-krzk@kernel.org> References: <20200826145153.10444-1-krzk@kernel.org> 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 also it prints the error value. Signed-off-by: Krzysztof Kozlowski --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 3fee3947f772..18a1898e3e34 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -1475,22 +1475,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, } st->vdd_supply = devm_regulator_get(dev, "vdd"); - if (IS_ERR(st->vdd_supply)) { - if (PTR_ERR(st->vdd_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vdd regulator %d\n", - (int)PTR_ERR(st->vdd_supply)); - - return PTR_ERR(st->vdd_supply); - } + if (IS_ERR(st->vdd_supply)) + return dev_err_probe(dev, PTR_ERR(st->vdd_supply), + "Failed to get vdd regulator\n"); st->vddio_supply = devm_regulator_get(dev, "vddio"); - if (IS_ERR(st->vddio_supply)) { - if (PTR_ERR(st->vddio_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vddio regulator %d\n", - (int)PTR_ERR(st->vddio_supply)); - - return PTR_ERR(st->vddio_supply); - } + if (IS_ERR(st->vddio_supply)) + return dev_err_probe(dev, PTR_ERR(st->vddio_supply), + "Failed to get vddio regulator\n"); result = regulator_enable(st->vdd_supply); if (result) { -- 2.17.1