* [PATCH v2] sfc: Convert to use ERR_CAST()
@ 2024-08-29 2:12 Shen Lichuan
2024-08-29 8:20 ` Martin Habets
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Shen Lichuan @ 2024-08-29 2:12 UTC (permalink / raw)
To: ecree.xilinx, habetsm.xilinx, davem, edumazet, kuba, pabeni
Cc: netdev, linux-net-drivers, linux-kernel, opensource.kernel,
Shen Lichuan
As opposed to open-code, using the ERR_CAST macro clearly indicates that
this is a pointer to an error value and a type conversion was performed.
Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
---
v1 -> v2: Removed the superfluous comment.
drivers/net/ethernet/sfc/tc_counters.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/tc_counters.c b/drivers/net/ethernet/sfc/tc_counters.c
index c44088424323..a421b0123506 100644
--- a/drivers/net/ethernet/sfc/tc_counters.c
+++ b/drivers/net/ethernet/sfc/tc_counters.c
@@ -249,7 +249,7 @@ struct efx_tc_counter_index *efx_tc_flower_get_counter_index(
&ctr->linkage,
efx_tc_counter_id_ht_params);
kfree(ctr);
- return (void *)cnt; /* it's an ERR_PTR */
+ return ERR_CAST(cnt);
}
ctr->cnt = cnt;
refcount_set(&ctr->ref, 1);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] sfc: Convert to use ERR_CAST()
2024-08-29 2:12 [PATCH v2] sfc: Convert to use ERR_CAST() Shen Lichuan
@ 2024-08-29 8:20 ` Martin Habets
2024-08-29 14:05 ` Edward Cree
2024-08-30 18:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Martin Habets @ 2024-08-29 8:20 UTC (permalink / raw)
To: Shen Lichuan
Cc: ecree.xilinx, davem, edumazet, kuba, pabeni, netdev,
linux-net-drivers, linux-kernel, opensource.kernel
On Thu, Aug 29, 2024 at 10:12:53AM +0800, Shen Lichuan wrote:
> As opposed to open-code, using the ERR_CAST macro clearly indicates that
> this is a pointer to an error value and a type conversion was performed.
>
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Martin Habets <habetsm.xilinx@gmail.com>
> ---
> v1 -> v2: Removed the superfluous comment.
>
> drivers/net/ethernet/sfc/tc_counters.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/tc_counters.c b/drivers/net/ethernet/sfc/tc_counters.c
> index c44088424323..a421b0123506 100644
> --- a/drivers/net/ethernet/sfc/tc_counters.c
> +++ b/drivers/net/ethernet/sfc/tc_counters.c
> @@ -249,7 +249,7 @@ struct efx_tc_counter_index *efx_tc_flower_get_counter_index(
> &ctr->linkage,
> efx_tc_counter_id_ht_params);
> kfree(ctr);
> - return (void *)cnt; /* it's an ERR_PTR */
> + return ERR_CAST(cnt);
> }
> ctr->cnt = cnt;
> refcount_set(&ctr->ref, 1);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] sfc: Convert to use ERR_CAST()
2024-08-29 2:12 [PATCH v2] sfc: Convert to use ERR_CAST() Shen Lichuan
2024-08-29 8:20 ` Martin Habets
@ 2024-08-29 14:05 ` Edward Cree
2024-08-30 18:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Edward Cree @ 2024-08-29 14:05 UTC (permalink / raw)
To: Shen Lichuan, habetsm.xilinx, davem, edumazet, kuba, pabeni
Cc: netdev, linux-net-drivers, linux-kernel, opensource.kernel
On 29/08/2024 03:12, Shen Lichuan wrote:
> As opposed to open-code, using the ERR_CAST macro clearly indicates that
> this is a pointer to an error value and a type conversion was performed.
>
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] sfc: Convert to use ERR_CAST()
2024-08-29 2:12 [PATCH v2] sfc: Convert to use ERR_CAST() Shen Lichuan
2024-08-29 8:20 ` Martin Habets
2024-08-29 14:05 ` Edward Cree
@ 2024-08-30 18:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-30 18:20 UTC (permalink / raw)
To: Shen Lichuan
Cc: ecree.xilinx, habetsm.xilinx, davem, edumazet, kuba, pabeni,
netdev, linux-net-drivers, linux-kernel, opensource.kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 29 Aug 2024 10:12:53 +0800 you wrote:
> As opposed to open-code, using the ERR_CAST macro clearly indicates that
> this is a pointer to an error value and a type conversion was performed.
>
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> v1 -> v2: Removed the superfluous comment.
>
> [...]
Here is the summary with links:
- [v2] sfc: Convert to use ERR_CAST()
https://git.kernel.org/netdev/net-next/c/74ce94ac38a6
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
end of thread, other threads:[~2024-08-30 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 2:12 [PATCH v2] sfc: Convert to use ERR_CAST() Shen Lichuan
2024-08-29 8:20 ` Martin Habets
2024-08-29 14:05 ` Edward Cree
2024-08-30 18:20 ` patchwork-bot+netdevbpf
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).