mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Thorsten Blum <thorsten.blum@toblux.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] w1: Fix number of bytes in error message
Date: Mon, 27 May 2024 13:51:18 +0200	[thread overview]
Message-ID: <98f19584-9851-46f0-a9dc-8dbae1793b72@kernel.org> (raw)
In-Reply-To: <20240513154354.185974-3-thorsten.blum@toblux.com>

On 13/05/2024 17:43, Thorsten Blum wrote:
> Fix the number of bytes that failed to be allocated for a new w1 device.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
>  drivers/w1/w1_int.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
> index 3a71c5eb2f83..677e7167806c 100644
> --- a/drivers/w1/w1_int.c
> +++ b/drivers/w1/w1_int.c
> @@ -34,7 +34,7 @@ static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
>  	dev = kzalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL);
>  	if (!dev) {
>  		pr_err("Failed to allocate %zd bytes for new w1 device.\n",
> -			sizeof(struct w1_master));
> +			sizeof(struct w1_master) + sizeof(struct w1_bus_master));

No, instead error message should be dropped. Core handles printing
memory allocation failures.

Best regards,
Krzysztof


  reply	other threads:[~2024-05-27 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 15:43 Thorsten Blum
2024-05-27 11:51 ` Krzysztof Kozlowski [this message]
2024-05-27 13:29   ` Thorsten Blum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98f19584-9851-46f0-a9dc-8dbae1793b72@kernel.org \
    --to=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@toblux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®