From patchwork Thu Sep 8 00:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 12969530 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34D87C38145 for ; Thu, 8 Sep 2022 00:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3EAD5hStBaOHnxdu5KaUDWiu9ai4uo2JcZE48d3dNnw=; b=WqX1a//zA/fJC5 hrvQq8fRZHFHwqc0iL6oUcCrietbs82ZQ+u8RDvBhbPtPSLgK+1PAEDGmU3nIA1SyIfXFQieGeaSM 9ozFnqKMRbLwKaGt9dvTomrOmD6vhZlIt6GYKgniqcx9mMGnnuskwGhuMCpcuLAfSSo2FVjPRei2H ClOL/tSxgM+RQ8tE+ktH09RyyZe9dlzycvrB5darRyo97AwfzIbY/vUnPPfSG7uDNslgGZ9wdcB2r IEaNfl6SkO5vuamIyqn5axzzXzh+TxZn0QSUYdTji2jC3qHzjz55UyAxvBGJHSse3hpPPj62ETWLF WMdBFU1rx+it1t8SSbeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oW5S0-00DFYF-Rg; Thu, 08 Sep 2022 00:31:24 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oW5Ru-00DEf1-QZ for linux-rockchip@lists.infradead.org; Thu, 08 Sep 2022 00:31:21 +0000 Received: from jupiter.universe (dyndsl-095-033-158-249.ewe-ip-backbone.de [95.33.158.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sre) by madras.collabora.co.uk (Postfix) with ESMTPSA id 2FDD26601F74; Thu, 8 Sep 2022 01:31:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1662597072; bh=xRma2ETMM0olKUTQ9twqk7M53dgq+Xn0+iYfdk15l2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHorh7ciehxz7I35mSdMLFYkTfbw9hkMe7sFZSEXaLVxKXNwoXRrV/f3DFIZcMi0K 2EOFZIA4VnftOlKrOu6Tob7z362wdngy+Z2CQ+QX+IfqtLCt2VRHP88nsoTRGsTdTc YlEZVMgMTsIrBSkkKm8nElJLLF0AqBMBDImzJ5ZTjTJcjZ4JVyVKBip7AdVsVesUKa Z0vnC0JGfaVy9N7Yu8tqMWj7SrTpf3BI+670wdRYuw3+KwGNEl3ucpzantfMimYoc5 UCBsdBZMCw5HFttuY+40ov7JPkOcTxmhOQf7MFKXpiCSWahEop60dn1dRBc7y9KzT7 qyZzN8m1kPh+g== Received: by jupiter.universe (Postfix, from userid 1000) id 5F2F04805BC; Thu, 8 Sep 2022 02:31:09 +0200 (CEST) From: Sebastian Reichel To: Heiko Stuebner , Rob Herring , Krzysztof Kozlowski , Lee Jones Cc: Michael Turquette , Stephen Boyd , Linus Walleij , Mark Brown , Liam Girdwood , Alexandre Belloni , Alessandro Zummo , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , kernel@collabora.com Subject: [PATCHv2 02/13] mfd: rk808: use dev_err_probe Date: Thu, 8 Sep 2022 02:30:56 +0200 Message-Id: <20220908003107.220143-3-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220908003107.220143-1-sebastian.reichel@collabora.com> References: <20220908003107.220143-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_173119_022595_9650C293 X-CRM114-Status: GOOD ( 14.36 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Use dev_err_probe instead of dev_err in probe function, which simplifies code a little bit and prints the error code. Signed-off-by: Sebastian Reichel --- drivers/mfd/rk808.c | 50 ++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index c17fea1d48ca..e793de9146f7 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -650,18 +650,14 @@ static int rk808_probe(struct i2c_client *client, /* Read chip variant */ msb = i2c_smbus_read_byte_data(client, pmic_id_msb); - if (msb < 0) { - dev_err(&client->dev, "failed to read the chip id at 0x%x\n", - RK808_ID_MSB); - return msb; - } + if (msb < 0) + return dev_err_probe(&client->dev, msb, "failed to read the chip id at 0x%x\n", + RK808_ID_MSB); lsb = i2c_smbus_read_byte_data(client, pmic_id_lsb); - if (lsb < 0) { - dev_err(&client->dev, "failed to read the chip id at 0x%x\n", - RK808_ID_LSB); - return lsb; - } + if (lsb < 0) + return dev_err_probe(&client->dev, lsb, "failed to read the chip id at 0x%x\n", + RK808_ID_LSB); rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK; dev_info(&client->dev, "chip id: 0x%x\n", (unsigned int)rk808->variant); @@ -710,44 +706,34 @@ static int rk808_probe(struct i2c_client *client, i2c_set_clientdata(client, rk808); rk808->regmap = devm_regmap_init_i2c(client, rk808->regmap_cfg); - if (IS_ERR(rk808->regmap)) { - dev_err(&client->dev, "regmap initialization failed\n"); - return PTR_ERR(rk808->regmap); - } + if (IS_ERR(rk808->regmap)) + return dev_err_probe(&client->dev, PTR_ERR(rk808->regmap), + "regmap initialization failed\n"); - if (!client->irq) { - dev_err(&client->dev, "No interrupt support, no core IRQ\n"); - return -EINVAL; - } + if (!client->irq) + return dev_err_probe(&client->dev, -EINVAL, "No interrupt support, no core IRQ\n"); ret = devm_regmap_add_irq_chip(&client->dev, rk808->regmap, client->irq, IRQF_ONESHOT, -1, rk808->regmap_irq_chip, &rk808->irq_data); - if (ret) { - dev_err(&client->dev, "Failed to add irq_chip %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(&client->dev, ret, "Failed to add irq_chip\n"); for (i = 0; i < nr_pre_init_regs; i++) { ret = regmap_update_bits(rk808->regmap, pre_init_reg[i].addr, pre_init_reg[i].mask, pre_init_reg[i].value); - if (ret) { - dev_err(&client->dev, - "0x%x write err\n", - pre_init_reg[i].addr); - return ret; - } + if (ret) + return dev_err_probe(&client->dev, ret, "0x%x write err\n", + pre_init_reg[i].addr); } ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, cells, nr_cells, NULL, 0, regmap_irq_get_domain(rk808->irq_data)); - if (ret) { - dev_err(&client->dev, "failed to add MFD devices %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(&client->dev, ret, "failed to add MFD devices\n"); if (of_property_read_bool(np, "rockchip,system-power-controller")) { ret = devm_register_sys_off_handler(&client->dev,