From nobody Sun Apr 5 16:46:38 2026 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B10F237BE87 for ; Tue, 24 Mar 2026 18:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774376872; cv=none; b=ZEZBLahwksSqYlk65qwrRD56woUj1mK8FEzGh+7TVt/x8xpSwt7pPkGVpT4cqM1pangTGwzwJqNNg2r9jJftFZgHZhzfo8iS9xysb1rXG5BDlLlAwv2/RP5maIKVnG1h8RnGFcqnyVdPbbYnibaCOzF8CEfJL5eIW0ihEYi0H3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774376872; c=relaxed/simple; bh=INy7r9nqYAh8xRryTtp2F3L3u24eOCBCoOZXV2Ktc3E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QlfFYq0keCiHYsWx9SjfkreUl9F+Plizes+AmH5qVNXF9Vv/7UAyxquSAiZDlIksRGsAu74t9t+Ayia29Lh6+5mTcY+ItKIYEWl2Ld0bpH/L5AqxtgrAD1ppDAyj2+pWhajO0KyR3XUAkq9089OZWZqOOp7/YFWrpkjkGCo9428= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qAkfYh2x; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qAkfYh2x" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-c70c112cb61so990044a12.0 for ; Tue, 24 Mar 2026 11:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774376870; x=1774981670; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YOUVvE5FNmjkaySdFPrc+7+hSpPNsoY2HaGuj8AkFfI=; b=qAkfYh2xYQHXiHGQvivSqGXRcMqtWLP3pggJM1DGosW4QJUlcSjbPvSm6kfq2uXYLi Ou8tZ65iGdJQ/xmJn+SXVToRlUTmNYFpdCB9UCWhQFG/2sXdWrFD7YHT0HirOt8/aQKM Y6pAVVpbtz1BjwZj+b5EzYj9Et0yFcDBVNo/lS+qimPsBuYxQjAGwZRP0+LRFRCGVhoz NA0txW/yQdxnUtw47dcAV8cgCFDLi1U0eaphyo7BBXWsF46CmTRIRK1p/rNxvX4PbUSR j5rKQwmNGjU9/LoAVe7HlzVvKhnPekeTATFynMs651ziTN9iXQ2/pe+bhBJT22TcqTq3 ea6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774376870; x=1774981670; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=YOUVvE5FNmjkaySdFPrc+7+hSpPNsoY2HaGuj8AkFfI=; b=lDyU7sABupWsCuqKaUK7OgfRv2D7q+08tzRNuJh+mvUNyequRCMaGZIiv3YsTOkAdA SrjDa+haHp07uNVmFB+IQNyX0Q249vT3XdHtdsTCLpDGX+xLKtZYUhpXnfA4RrK2Zen2 n4YUocd/2tKNt8UhxPDpzSFZCMF3ieqDtJVAd96cfIfjnuXGIU2vJmQ/KEJn1yEGYcno BbDY4sFOUbuUG6WdtqocN2Jkm4p0lOEm30uSNDhP+J8AOMJxdVaY0Km/goJF7GQXw7A2 GNd5/C/Du/a4EtnlDkvBHPnVHSPP8FJTg/hOQs87pDZGhIffZT9VG62B4Fo+YOwCxbyZ SsIg== X-Forwarded-Encrypted: i=1; AJvYcCU5z/X3BVhAX9+0euXlc3yHcreA4va5R78Kx6PFTUb/enw/zw/QxgkC6BaFYMtWAYJEOAn/Uj9NZk9CCsI=@vger.kernel.org X-Gm-Message-State: AOJu0YwSxufNFCcMrGf0Dz4dN0/R3xDmTXu5KZVbG8rZXJ7WlbJdRwtB L1w/YvMJo+EtcEcTm0tFpCCRRshmgUc6KM5cbFpi6LarWHLehmylAhoS X-Gm-Gg: ATEYQzwztQosjqfG384sL4ljl4cmSJjNq496A95qlc9PJ5pfnv4Cx1ZjTUMvy2al4sN uTeAoFh2we08VcigU2u/sfVAbj1NtxT8AqLLWRnjcf1UkMHhl0TKljTaRgPrVLdNBMcDpZu4wuC S50z24k1NaGYSgK5Vz+/LakNcSVRQLb1YUqgN1Dtkxi6GqovdA0sRYO6dIa7Oug9Xdc0XrzeLbo lpNPcKsFw9dYsyz/Qg/DNnsRN2j4h2/Ysi3wpzg9Z4iG7gL7H8bh0hc5b0rtVIIDQuF4ZYoCQ8Z fCn84HreGnz1FZzcv4SKOjzMbxj2jrukkc8zCNBSl9uD+OTXRXM2aggjaMPBSh/3QB5tOLcxooi uiXumjk0ckae4gQKI5wcczX3C+YM0V+nZaO9JoIrJZF5A3jNkexSdJEe1Pv2SXdxd4JoMXLB2M6 0WsCotrFBNXGB1uGtcxlO1zjb3ya3SB+oxJZ/H X-Received: by 2002:a17:90b:1dcd:b0:35b:a656:a60a with SMTP id 98e67ed59e1d1-35c0dcf48dbmr341601a91.8.1774376869963; Tue, 24 Mar 2026 11:27:49 -0700 (PDT) Received: from [127.0.1.1] ([103.216.213.160]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35c0d6060b5sm350576a91.17.2026.03.24.11.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 11:27:49 -0700 (PDT) From: Atharv Dubey Date: Tue, 24 Mar 2026 23:56:52 +0530 Subject: [PATCH 04/10] i2c: stm32f7: Replace dev_err() with dev_err_probe() in probe function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260324-deverr-v1-4-7e591cce33a3@gmail.com> References: <20260324-deverr-v1-0-7e591cce33a3@gmail.com> In-Reply-To: <20260324-deverr-v1-0-7e591cce33a3@gmail.com> To: Till Harbaum , Andi Shyti , Laxman Dewangan , Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Pierre-Yves MORDRET , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Patrice Chotard , Orson Zhai , Baolin Wang , Chunyan Zhang , Jean Delvare Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, Enrico Zanda , Atharv Dubey X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774376818; l=6197; i=atharvd440@gmail.com; s=20260314; h=from:subject:message-id; bh=s9JDU7GcgsnDDFXsrCxagGOfCSdKXg3wGsXTsgZz2H0=; b=ah0pTzAjwcV8FwCOGin97Y4dMl89Nw1GTUGKElGrgDchfwSWIGhdZL4fJM5yOH/LB2Vze2ERu 5pFUk9n36AADxerpZp4V7L4H+yM/I6gEVGRW6UOTZNuNCinHlE0yV/c X-Developer-Key: i=atharvd440@gmail.com; a=ed25519; pk=T6i1xWOKT/RUSDYATSgyVG/4X7ac8jPjRSG1mMAcqVk= From: Enrico Zanda This simplifies the code while improving log. Signed-off-by: Enrico Zanda Signed-off-by: Atharv Dubey --- drivers/i2c/busses/i2c-stm32f7.c | 78 ++++++++++++++++--------------------= ---- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm3= 2f7.c index 70cb5822bf17..e7cc7f0fb56c 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -481,28 +481,22 @@ static int stm32f7_i2c_compute_timing(struct stm32f7_= i2c_dev *i2c_dev, int ret =3D 0; =20 specs =3D stm32f7_get_specs(setup->speed_freq); - if (specs =3D=3D ERR_PTR(-EINVAL)) { - dev_err(i2c_dev->dev, "speed out of bound {%d}\n", - setup->speed_freq); - return -EINVAL; - } + if (specs =3D=3D ERR_PTR(-EINVAL)) + return dev_err_probe(i2c_dev->dev, -EINVAL, "speed out of bound {%d}\n", + setup->speed_freq); =20 if ((setup->rise_time > specs->rise_max) || - (setup->fall_time > specs->fall_max)) { - dev_err(i2c_dev->dev, - "timings out of bound Rise{%d>%d}/Fall{%d>%d}\n", - setup->rise_time, specs->rise_max, - setup->fall_time, specs->fall_max); - return -EINVAL; - } + (setup->fall_time > specs->fall_max)) + return dev_err_probe(i2c_dev->dev, -EINVAL, + "timings out of bound Rise{%d>%d}/Fall{%d>%d}\n", + setup->rise_time, specs->rise_max, + setup->fall_time, specs->fall_max); =20 i2c_dev->dnf =3D DIV_ROUND_CLOSEST(i2c_dev->dnf_dt, i2cclk); - if (i2c_dev->dnf > STM32F7_I2C_DNF_MAX) { - dev_err(i2c_dev->dev, - "DNF out of bound %d/%d\n", - i2c_dev->dnf * i2cclk, STM32F7_I2C_DNF_MAX * i2cclk); - return -EINVAL; - } + if (i2c_dev->dnf > STM32F7_I2C_DNF_MAX) + return dev_err_probe(i2c_dev->dev, -EINVAL, + "DNF out of bound %d/%d\n", i2c_dev->dnf * i2cclk, + STM32F7_I2C_DNF_MAX * i2cclk); =20 /* Analog and Digital Filters */ af_delay_min =3D @@ -567,8 +561,7 @@ static int stm32f7_i2c_compute_timing(struct stm32f7_i2= c_dev *i2c_dev, } =20 if (list_empty(&solutions)) { - dev_err(i2c_dev->dev, "no Prescaler solution\n"); - ret =3D -EPERM; + ret =3D dev_err_probe(i2c_dev->dev, -EPERM, "no Prescaler solution\n"); goto exit; } =20 @@ -624,8 +617,7 @@ static int stm32f7_i2c_compute_timing(struct stm32f7_i2= c_dev *i2c_dev, } =20 if (!s) { - dev_err(i2c_dev->dev, "no solution at all\n"); - ret =3D -EPERM; + ret =3D dev_err_probe(i2c_dev->dev, -EPERM, "no solution at all\n"); goto exit; } =20 @@ -674,11 +666,9 @@ static int stm32f7_i2c_setup_timing(struct stm32f7_i2c= _dev *i2c_dev, =20 i2c_parse_fw_timings(i2c_dev->dev, t, false); =20 - if (t->bus_freq_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) { - dev_err(i2c_dev->dev, "Invalid bus speed (%i>%i)\n", - t->bus_freq_hz, I2C_MAX_FAST_MODE_PLUS_FREQ); - return -EINVAL; - } + if (t->bus_freq_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) + return dev_err_probe(i2c_dev->dev, -EINVAL, "Invalid bus speed (%i>%i)\n= ", + t->bus_freq_hz, I2C_MAX_FAST_MODE_PLUS_FREQ); =20 setup->speed_freq =3D t->bus_freq_hz; i2c_dev->setup.rise_time =3D t->scl_rise_ns; @@ -686,10 +676,8 @@ static int stm32f7_i2c_setup_timing(struct stm32f7_i2c= _dev *i2c_dev, i2c_dev->dnf_dt =3D t->digital_filter_width_ns; setup->clock_src =3D clk_get_rate(i2c_dev->clk); =20 - if (!setup->clock_src) { - dev_err(i2c_dev->dev, "clock rate is 0\n"); - return -EINVAL; - } + if (!setup->clock_src) + return dev_err_probe(i2c_dev->dev, -EINVAL, "clock rate is 0\n"); =20 if (!of_property_read_bool(i2c_dev->dev->of_node, "i2c-digital-filter")) i2c_dev->dnf_dt =3D STM32F7_I2C_DNF_DEFAULT; @@ -698,8 +686,8 @@ static int stm32f7_i2c_setup_timing(struct stm32f7_i2c_= dev *i2c_dev, ret =3D stm32f7_i2c_compute_timing(i2c_dev, setup, &i2c_dev->timing); if (ret) { - dev_err(i2c_dev->dev, - "failed to compute I2C timings.\n"); + dev_err_probe(i2c_dev->dev, ret, + "failed to compute I2C timings.\n"); if (setup->speed_freq <=3D I2C_MAX_STANDARD_MODE_FREQ) break; setup->speed_freq =3D @@ -710,10 +698,8 @@ static int stm32f7_i2c_setup_timing(struct stm32f7_i2c= _dev *i2c_dev, } } while (ret); =20 - if (ret) { - dev_err(i2c_dev->dev, "Impossible to compute I2C timings.\n"); - return ret; - } + if (ret) + return dev_err_probe(i2c_dev->dev, ret, "Impossible to compute I2C timin= gs.\n"); =20 i2c_dev->analog_filter =3D of_property_read_bool(i2c_dev->dev->of_node, "i2c-analog-filter"); @@ -2175,10 +2161,8 @@ static int stm32f7_i2c_probe(struct platform_device = *pdev) return -ENOMEM; =20 setup =3D of_device_get_match_data(&pdev->dev); - if (!setup) { - dev_err(&pdev->dev, "Can't get device data\n"); - return -ENODEV; - } + if (!setup) + return dev_err_probe(&pdev->dev, -ENODEV, "Can't get device data\n"); i2c_dev->setup =3D *setup; =20 i2c_dev->base =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); @@ -2279,7 +2263,7 @@ static int stm32f7_i2c_probe(struct platform_device *= pdev) =20 ret =3D dev_pm_set_wake_irq(i2c_dev->dev, irq_event); if (ret) { - dev_err(i2c_dev->dev, "Failed to set wake up irq\n"); + dev_err_probe(i2c_dev->dev, ret, "Failed to set wake up irq\n"); goto clr_wakeup_capable; } } @@ -2305,9 +2289,8 @@ static int stm32f7_i2c_probe(struct platform_device *= pdev) if (i2c_dev->smbus_mode) { ret =3D stm32f7_i2c_enable_smbus_host(i2c_dev); if (ret) { - dev_err(i2c_dev->dev, - "failed to enable SMBus Host-Notify protocol (%d)\n", - ret); + dev_err_probe(i2c_dev->dev, ret, + "failed to enable SMBus Host-Notify protocol\n"); goto i2c_adapter_remove; } } @@ -2315,9 +2298,8 @@ static int stm32f7_i2c_probe(struct platform_device *= pdev) if (of_property_read_bool(pdev->dev.of_node, "smbus-alert")) { ret =3D stm32f7_i2c_enable_smbus_alert(i2c_dev); if (ret) { - dev_err(i2c_dev->dev, - "failed to enable SMBus alert protocol (%d)\n", - ret); + dev_err_probe(i2c_dev->dev, ret, + "failed to enable SMBus alert protocol\n"); goto i2c_disable_smbus_host; } } --=20 2.43.0