mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Henry Martin <bsdhenrymartin@gmail.com>,
	linux-aspeed@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Andrew Jeffery" <andrew@codeconstruct.com.au>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Gabriel Somlo" <gsomlo@gmail.com>,
	"Herve Codina" <herve.codina@bootlin.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: Re: [PATCH v2] drivers/misc: Add NULL check in aspeed_lpc_enable_snoop
Date: Mon, 31 Mar 2025 17:46:19 +0200	[thread overview]
Message-ID: <81279dfd-0586-4f12-a3f7-1a4397646d43@web.de> (raw)
In-Reply-To: <20250331151238.13703-1-bsdhenrymartin@gmail.com>

> devm_kasprintf() returns NULL if memory allocation fails. Currently,
…
                 call?                               failed?


An other subsystem specification might be more desirable.
https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/soc/aspeed/aspeed-lpc-snoop.c?h=next-20250331> +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
> @@ -200,6 +200,8 @@ static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop,
>  	lpc_snoop->chan[channel].miscdev.minor = MISC_DYNAMIC_MINOR;
>  	lpc_snoop->chan[channel].miscdev.name =
>  		devm_kasprintf(dev, GFP_KERNEL, "%s%d", DEVICE_NAME, channel);
> +	if (!lpc_snoop->chan[channel].miscdev.name)
> +		return -ENOMEM;
…

Can a blank line be preferred after such a statement?


* May the array access be simplified another bit here?
* How do you think about to store a pointer to a corresponding data structure member
  in an additional local variable?


Regards,
Markus

      reply	other threads:[~2025-03-31 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 15:12 Henry Martin
2025-03-31 15:46 ` Markus Elfring [this message]

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=81279dfd-0586-4f12-a3f7-1a4397646d43@web.de \
    --to=markus.elfring@web.de \
    --cc=andrew@codeconstruct.com.au \
    --cc=arnd@arndb.de \
    --cc=bsdhenrymartin@gmail.com \
    --cc=gsomlo@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.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®