Re: [PATCH] gsmi: Replace printk with relevant pr_<level>

From: Greg KH
Date: Wed Jun 12 2019 - 11:15:12 EST


On Wed, Jun 12, 2019 at 07:57:27PM +0530, Saiyam Doshi wrote:
> >From 3a9cec48147b24fd9d793e0fdf20058461445646 Mon Sep 17 00:00:00 2001
> From: Saiyam Doshi <saiyamdoshi.in@xxxxxxxxx>
> Date: Tue, 11 Jun 2019 19:21:50 +0530
> Subject: [PATCH] gsmi: Replace printk with relevant pr_<level>


Why is all of this in the changelog body?

Please just use 'git send-email' if you can not use a decent email
client.

> Replace printk() with pr_* macros for logging consistency.
> This also helps avoid checkpatch warnings.
>
> Signed-off-by: Saiyam Doshi <saiyamdoshi.in@xxxxxxxxx>
> ---
> drivers/firmware/google/gsmi.c | 59 ++++++++++++++++------------------
> 1 file changed, 28 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
> index edaa4e5d84ad..e4e7f04bced8 100644
> --- a/drivers/firmware/google/gsmi.c
> +++ b/drivers/firmware/google/gsmi.c
> @@ -151,7 +151,7 @@ static struct gsmi_buf *gsmi_buf_alloc(void)
>
> smibuf = kzalloc(sizeof(*smibuf), GFP_KERNEL);
> if (!smibuf) {
> - printk(KERN_ERR "gsmi: out of memory\n");
> + pr_err("gsmi: out of memory\n");

This message is not needed at all, checkpatch should have warned you
about that.

> return NULL;
> }
>
> @@ -159,7 +159,7 @@ static struct gsmi_buf *gsmi_buf_alloc(void)
> smibuf->start = dma_pool_alloc(gsmi_dev.dma_pool, GFP_KERNEL,
> &smibuf->handle);
> if (!smibuf->start) {
> - printk(KERN_ERR "gsmi: failed to allocate name buffer\n");
> + pr_err("gsmi: failed to allocate name buffer\n");
> kfree(smibuf);
> return NULL;
> }
> @@ -257,34 +257,33 @@ static int gsmi_exec(u8 func, u8 sub)
> rc = 1;
> break;
> case GSMI_INVALID_PARAMETER:
> - printk(KERN_ERR "gsmi: exec 0x%04x: Invalid parameter\n", cmd);
> + pr_err("gsmi: exec 0x%04x: Invalid parameter\n", cmd);

why not dev_err() for all of these? It's a driver, you should have a
device, use it so that the user has a chance to know what device is
acting up.

thanks,

greg k-h