Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp352056rwn; Wed, 7 Sep 2022 18:12:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR6amNqlXw/KB7qkbifG3z4RlEAt2ijnpaAr3F4ISN4DSLkE1Zz7oEz2YjL+mZ1A17mvc+O5 X-Received: by 2002:a65:498b:0:b0:412:8e4:2842 with SMTP id r11-20020a65498b000000b0041208e42842mr5729501pgs.71.1662599565396; Wed, 07 Sep 2022 18:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662599565; cv=none; d=google.com; s=arc-20160816; b=embc0QA1Mh2SXDLgGpw64Rr+dVW0dGVXMU1lTxtT0j59eJo/W8XDovUhTSUJjyIV9k ZlgCSmDaq+hVed0WEC95wU7fV77OJhuoXRkFib+38i21vwWzVheorwv7RI8Ym0oG9V6f 52fduKKEWPp53e4XG64pKRm7ylnwKkD0QTELFp6DWnMPWD3JW/hwpmLDsbBzHBpPdEt8 y21I1YYnM0UQic+6KdcZLxNS0A+X88j+b4kkiIKpuyTeI7RuIR6SZu/5wEVIM8suz9/O g8YGMurA+JYlifU1/2y6234EtmZSOkEHqCMqDdeKypBh0mxFUfqaO4jiFrdJld69+G82 a3UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EQEt01W3i/H1V86anYXvdCpso5cqNpxq8Uu5/5rORzU=; b=esHITclFEOfCU9f91gp+m1JNEeirpzQnnMoqwY3gSs7ji2t1n9tX+6DLwN9JvcaV/j WNC/jhHxmuX0u+JBlSgcaBbJlaQwj5nUw2DgJ2JELSHw5TaaxsYdodIdlkRnNgM5KBnk pJR2Kuns3TTTcVXbCOmf+QGqCzvtQdhc22uG7AUJf7AFNNSOQ1381zltYVy++GeoiDud yJagHfnrSm6hm3eiCdnkaoMAjaxRFh626vhdeKv2Ezj/8MPf/TIwb1W1KT/UZom9Ipag 8r8vNA0Y/K24oOMfPxSnJo1F7qnmyxgMmXzTXEgIJku+wwX6OhLwGtM7fAxC2Xf/Q//L IdpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NHorh7ci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m11-20020a1709026bcb00b001713df1fd46si4285805plt.568.2022.09.07.18.12.30; Wed, 07 Sep 2022 18:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NHorh7ci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbiIHAbU (ORCPT + 99 others); Wed, 7 Sep 2022 20:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbiIHAbQ (ORCPT ); Wed, 7 Sep 2022 20:31:16 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0898E4CE; Wed, 7 Sep 2022 17:31:14 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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, -- 2.35.1