[v2,0/2] nfc: hci: Save a few bytes of memory when registering a 'nfc_llc' engine

Message ID cover.1706946099.git.christophe.jaillet@wanadoo.fr
Headers
Series nfc: hci: Save a few bytes of memory when registering a 'nfc_llc' engine |

Message

Christophe JAILLET Feb. 3, 2024, 7:51 a.m. UTC
  nfc_llc_register() calls pass a string literal as the 'name' parameter.

So kstrdup_const() can be used instead of kfree() to avoid a memory
allocation in such cases.

v2: Add a new helper function, nfc_llc_del_engine(), to reduce code
    duplication. This is needed to address Jakub Kicinski's comment
    about nfc_llc_exit() that was not updated in v1.

v1: https://lore.kernel.org/all/6d2b8c390907dcac2e4dc6e71f1b2db2ef8abef1.1705744530.git.christophe.jaillet@wanadoo.fr/

Christophe JAILLET (2):
  nfc: hci: Introduce nfc_llc_del_engine() to reduce code duplication
  nfc: hci: Save a few bytes of memory when registering a 'nfc_llc'
    engine

 net/nfc/hci/llc.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
  

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 6, 2024, 2:40 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sat,  3 Feb 2024 08:51:02 +0100 you wrote:
> nfc_llc_register() calls pass a string literal as the 'name' parameter.
> 
> So kstrdup_const() can be used instead of kfree() to avoid a memory
> allocation in such cases.
> 
> v2: Add a new helper function, nfc_llc_del_engine(), to reduce code
>     duplication. This is needed to address Jakub Kicinski's comment
>     about nfc_llc_exit() that was not updated in v1.
> 
> [...]

Here is the summary with links:
  - [v2,1/2] nfc: hci: Introduce nfc_llc_del_engine() to reduce code duplication
    https://git.kernel.org/netdev/net-next/c/d6f4aac19ad4
  - [v2,2/2] nfc: hci: Save a few bytes of memory when registering a 'nfc_llc' engine
    https://git.kernel.org/netdev/net-next/c/83cdd8db7508

You are awesome, thank you!