* [PATCH v1] net: alacritech: Switch to use dev_err_probe()
@ 2024-08-28 12:26 Yang Ruibin
2024-08-28 22:11 ` Jacob Keller
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yang Ruibin @ 2024-08-28 12:26 UTC (permalink / raw)
To: Lino Sanfilippo, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
Cc: opensource.kernel, Yang Ruibin
use dev_err_probe() instead of dev_err() to simplify the error path and
standardize the format of the error code.
Signed-off-by: Yang Ruibin <11162571@vivo.com>
---
drivers/net/ethernet/alacritech/slicoss.c | 34 ++++++++++-------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c
index 78231c852..65919ace0 100644
--- a/drivers/net/ethernet/alacritech/slicoss.c
+++ b/drivers/net/ethernet/alacritech/slicoss.c
@@ -1051,11 +1051,9 @@ static int slic_load_rcvseq_firmware(struct slic_device *sdev)
file = (sdev->model == SLIC_MODEL_OASIS) ? SLIC_RCV_FIRMWARE_OASIS :
SLIC_RCV_FIRMWARE_MOJAVE;
err = request_firmware(&fw, file, &sdev->pdev->dev);
- if (err) {
- dev_err(&sdev->pdev->dev,
+ if (err)
+ return dev_err_probe(&sdev->pdev->dev, err,
"failed to load receive sequencer firmware %s\n", file);
- return err;
- }
/* Do an initial sanity check concerning firmware size now. A further
* check follows below.
*/
@@ -1126,10 +1124,9 @@ static int slic_load_firmware(struct slic_device *sdev)
file = (sdev->model == SLIC_MODEL_OASIS) ? SLIC_FIRMWARE_OASIS :
SLIC_FIRMWARE_MOJAVE;
err = request_firmware(&fw, file, &sdev->pdev->dev);
- if (err) {
- dev_err(&sdev->pdev->dev, "failed to load firmware %s\n", file);
- return err;
- }
+ if (err)
+ return dev_err_probe(&sdev->pdev->dev, err,
+ "failed to load firmware %s\n", file);
/* Do an initial sanity check concerning firmware size now. A further
* check follows below.
*/
@@ -1678,17 +1675,15 @@ static int slic_init(struct slic_device *sdev)
slic_card_reset(sdev);
err = slic_load_firmware(sdev);
- if (err) {
- dev_err(&sdev->pdev->dev, "failed to load firmware\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(&sdev->pdev->dev, err,
+ "failed to load firmware\n");
/* we need the shared memory to read EEPROM so set it up temporarily */
err = slic_init_shmem(sdev);
- if (err) {
- dev_err(&sdev->pdev->dev, "failed to init shared memory\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(&sdev->pdev->dev, err,
+ "failed to init shared memory\n");
err = slic_read_eeprom(sdev);
if (err) {
@@ -1741,10 +1736,9 @@ static int slic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int err;
err = pci_enable_device(pdev);
- if (err) {
- dev_err(&pdev->dev, "failed to enable PCI device\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(&pdev->dev, err,
+ "failed to enable PCI device\n");
pci_set_master(pdev);
pci_try_set_mwi(pdev);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] net: alacritech: Switch to use dev_err_probe()
2024-08-28 12:26 [PATCH v1] net: alacritech: Switch to use dev_err_probe() Yang Ruibin
@ 2024-08-28 22:11 ` Jacob Keller
2024-08-29 19:00 ` patchwork-bot+netdevbpf
2024-08-30 16:54 ` Krzysztof Kozlowski
2 siblings, 0 replies; 4+ messages in thread
From: Jacob Keller @ 2024-08-28 22:11 UTC (permalink / raw)
To: Yang Ruibin, Lino Sanfilippo, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Cc: opensource.kernel
nit: subject should include "net-next" for changes like this which are
cleanups meant for the net-next tree.
On 8/28/2024 5:26 AM, Yang Ruibin wrote:x
> use dev_err_probe() instead of dev_err() to simplify the error path and
> standardize the format of the error code.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/net/ethernet/alacritech/slicoss.c | 34 ++++++++++-------------
> 1 file changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c
> index 78231c852..65919ace0 100644
> --- a/drivers/net/ethernet/alacritech/slicoss.c
> +++ b/drivers/net/ethernet/alacritech/slicoss.c
> @@ -1051,11 +1051,9 @@ static int slic_load_rcvseq_firmware(struct slic_device *sdev)
> file = (sdev->model == SLIC_MODEL_OASIS) ? SLIC_RCV_FIRMWARE_OASIS :
> SLIC_RCV_FIRMWARE_MOJAVE;
> err = request_firmware(&fw, file, &sdev->pdev->dev);
> - if (err) {
> - dev_err(&sdev->pdev->dev,
> + if (err)
> + return dev_err_probe(&sdev->pdev->dev, err,
> "failed to load receive sequencer firmware %s\n", file);
Nice. dev_err_probe also handles some specific behavior for
-EPROBE_DEFER, which isn't being used here. That's fine since the custom
logic only triggers specifically on -EPROBE_DEFER. It also has custom
handling to avoid logging an error message on -ENOMEM. Neat.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] net: alacritech: Switch to use dev_err_probe()
2024-08-28 12:26 [PATCH v1] net: alacritech: Switch to use dev_err_probe() Yang Ruibin
2024-08-28 22:11 ` Jacob Keller
@ 2024-08-29 19:00 ` patchwork-bot+netdevbpf
2024-08-30 16:54 ` Krzysztof Kozlowski
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-29 19:00 UTC (permalink / raw)
To: Yang Ruibin
Cc: LinoSanfilippo, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, opensource.kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 28 Aug 2024 20:26:49 +0800 you wrote:
> use dev_err_probe() instead of dev_err() to simplify the error path and
> standardize the format of the error code.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/net/ethernet/alacritech/slicoss.c | 34 ++++++++++-------------
> 1 file changed, 14 insertions(+), 20 deletions(-)
Here is the summary with links:
- [v1] net: alacritech: Switch to use dev_err_probe()
https://git.kernel.org/netdev/net-next/c/bf4d87f884fe
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] net: alacritech: Switch to use dev_err_probe()
2024-08-28 12:26 [PATCH v1] net: alacritech: Switch to use dev_err_probe() Yang Ruibin
2024-08-28 22:11 ` Jacob Keller
2024-08-29 19:00 ` patchwork-bot+netdevbpf
@ 2024-08-30 16:54 ` Krzysztof Kozlowski
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-30 16:54 UTC (permalink / raw)
To: Yang Ruibin, Lino Sanfilippo, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Cc: opensource.kernel
On 28/08/2024 14:26, Yang Ruibin wrote:
> use dev_err_probe() instead of dev_err() to simplify the error path and
> standardize the format of the error code.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/net/ethernet/alacritech/slicoss.c | 34 ++++++++++-------------
> 1 file changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c
> index 78231c852..65919ace0 100644
> --- a/drivers/net/ethernet/alacritech/slicoss.c
> +++ b/drivers/net/ethernet/alacritech/slicoss.c
> @@ -1051,11 +1051,9 @@ static int slic_load_rcvseq_firmware(struct slic_device *sdev)
> file = (sdev->model == SLIC_MODEL_OASIS) ? SLIC_RCV_FIRMWARE_OASIS :
> SLIC_RCV_FIRMWARE_MOJAVE;
> err = request_firmware(&fw, file, &sdev->pdev->dev);
> - if (err) {
> - dev_err(&sdev->pdev->dev,
> + if (err)
> + return dev_err_probe(&sdev->pdev->dev, err,
> "failed to load receive sequencer firmware %s\n", file);
NAK.
Vivo does not understand how deferred probe works or introduces
intentionally buggy code.
This must be reverted.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-30 16:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 12:26 [PATCH v1] net: alacritech: Switch to use dev_err_probe() Yang Ruibin
2024-08-28 22:11 ` Jacob Keller
2024-08-29 19:00 ` patchwork-bot+netdevbpf
2024-08-30 16:54 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).