* [PATCH] tpm: make const pointer desc a static const array
@ 2021-11-27 17:26 Colin Ian King
2021-11-29 20:09 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2021-11-27 17:26 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, linux-integrity
Cc: kernel-janitors, linux-kernel
Make const pointer desc a static const array, removes a dereference
and shrinks object code a few bytes.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/char/tpm/tpm_tis_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index b2659a4c4016..649b4229e76e 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -716,7 +716,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
{
- const char *desc = "attempting to generate an interrupt";
+ static const char desc[] = "attempting to generate an interrupt";
u32 cap2;
cap_t cap;
int ret;
--
2.33.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tpm: make const pointer desc a static const array
2021-11-27 17:26 [PATCH] tpm: make const pointer desc a static const array Colin Ian King
@ 2021-11-29 20:09 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2021-11-29 20:09 UTC (permalink / raw)
To: Colin Ian King, Peter Huewe, Jason Gunthorpe, linux-integrity
Cc: kernel-janitors, linux-kernel
On Sat, 2021-11-27 at 17:26 +0000, Colin Ian King wrote:
> Make const pointer desc a static const array, removes a dereference
> and shrinks object code a few bytes.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/char/tpm/tpm_tis_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index b2659a4c4016..649b4229e76e 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -716,7 +716,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
>
> static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
> {
> - const char *desc = "attempting to generate an interrupt";
> + static const char desc[] = "attempting to generate an interrupt";
> u32 cap2;
> cap_t cap;
> int ret;
I'd rather go for:
#define TPM_TIS_GEN_INTERRUPT_DESC "attempting to generate an interrupt"
/Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-29 23:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 17:26 [PATCH] tpm: make const pointer desc a static const array Colin Ian King
2021-11-29 20:09 ` Jarkko Sakkinen
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).