Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1549857rwi; Thu, 20 Oct 2022 14:03:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5j/mr9Pjsp+6Pjl7KaB4FI36U1bDvqQg98YohyuUqsvJIEtghZ2UFRsIogLrawFuMW16fi X-Received: by 2002:a05:6402:278e:b0:45d:de37:f7fb with SMTP id b14-20020a056402278e00b0045dde37f7fbmr13915088ede.419.1666299783285; Thu, 20 Oct 2022 14:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666299783; cv=none; d=google.com; s=arc-20160816; b=ekTS0AyMAITESvB0qx8fqJpUwvgcD/UBaR9mTffD6UTTZms+IWuOfxewmVfPn92I8k qbct3rA0ZaTUa7e77j9mz5/rjDuM1Rw6x6O2DxQLd/Wnx2k7E1djWuosKBh8MkLju4T6 T4+KRIiyMRQ9Pa8m+KOYlU1EIioDcJ+ABl1Oolls3N7Y71Bcygd/7Osx78R+C9wXXgSe sz+rw5lVe11YAIZWU8fk4+jO4aAcBEh50i80hj245ABg4k/VTCNpCDyfgFHw82lvcq5I hDJoCDOCr+pQ9h4H6TavlCkCQlD+qevxmtu0aIveCmfnNnXVfufKLleUaJBvvqYTxRAN falg== 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=KjNsD9ApdVm77p2puLT+MDSmjh5XUsqleYLmRgmghlY=; b=Wkxv5n2tB3u8kIZ7vRAUOr2uVFcXpwnPldVFOdLOAfeCtC89nDzrEXhRLeRBQYiujB UFwBQcAT9WR/zS4Yoj+wVQrmLGSB63HRlYgqZkba5IzBm7hhd48gVKH57FMOCGgEWAWH w8ew4seoevxeEOJHzVSlWgX1U/eXThaHt5TE+Ao9hrUyurVRBI7Tlh51EM6sYUY/L70h MW2dAW9qreSQ29kw70bpfCYkHH/w2VACa54yWC+rYK+MM//SwloC+x4GObc8ZneDGOfy b4umNTWAtnznEjGOmRtiGg0P9I6qcTJLi3EM+Zqxa0PYVlSkvvEX+eq0LawlUCsla8c8 RBYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="n/OTYWRt"; 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 ga29-20020a1709070c1d00b00782faf12c6esi19095716ejc.78.2022.10.20.14.02.36; Thu, 20 Oct 2022 14:03:03 -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="n/OTYWRt"; 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 S229866AbiJTUoK (ORCPT + 99 others); Thu, 20 Oct 2022 16:44:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiJTUnO (ORCPT ); Thu, 20 Oct 2022 16:43:14 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D7B220C991; Thu, 20 Oct 2022 13:43:12 -0700 (PDT) Received: from jupiter.universe (dyndsl-091-096-059-009.ewe-ip-backbone.de [91.96.59.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: sre) by madras.collabora.co.uk (Postfix) with ESMTPSA id 76C676602543; Thu, 20 Oct 2022 21:42:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1666298577; bh=C4rSlAjjk6FnyUjlV+Ulcq/vHVHixGWvQH5PlFR+XVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/OTYWRtkPo8jULj0SiGB8tTBE851CvThHmdtxEUBU93lXaY5Q4bznVE0glJl25ga Biw/Sf3MtpBF1s/xQsjx3JPLxKH4RW4cYkLSzXGmqP1v1DDBqlPanXAFu68mwPu8ef lsLuRWrlIv1RGLAlUaFfYE5n/+MzrtH07jeevRLGgox0pprt+Ak+XIf4ZnomoR/lE5 NoyNUIhVBdJb/UJzMT8P6LhvT1MClOcEiw1Up8WDpRkwURyutjjADFiFtfsIHp5LBN j0mxmtRFygLPBDQQyzxmeEZK859lAXvy1QoLAmG6msV0GUcL1YBEsQYaffq0NQ+JNg 1+YxmHT65sS6g== Received: by jupiter.universe (Postfix, from userid 1000) id 591E448089A; Thu, 20 Oct 2022 22:42:52 +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: [PATCHv4 05/13] mfd: rk808: use dev_err_probe Date: Thu, 20 Oct 2022 22:42:43 +0200 Message-Id: <20221020204251.108565-6-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221020204251.108565-1-sebastian.reichel@collabora.com> References: <20221020204251.108565-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, URIBL_BLOCKED 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. Also drop possibly incorrect printing of chip id registers while touching the error message. Acked-for-MFD-by: Lee Jones Signed-off-by: Sebastian Reichel --- drivers/mfd/rk808.c | 48 +++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index e2e7a2c85019..5e0e5f320525 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -664,18 +664,12 @@ 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 MSB\n"); 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 LSB\n"); rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK; dev_info(&client->dev, "chip id: 0x%x\n", (unsigned int)rk808->variant); @@ -724,44 +718,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