mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH v3 5/7] spi: reduce scope of 'chip'
Date: Fri, 10 Mar 2023 10:42:20 +0100	[thread overview]
Message-ID: <20230310094222.2538259-6-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20230310094222.2538259-1-s.hauer@pengutronix.de>

Reducde scope of struct spi_board_info chip to the loop where it is
actually only used. While at it drop the memset and let the compiler
do the work of initialising it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1444fe3741..3684647f6e 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -108,7 +108,6 @@ EXPORT_SYMBOL(spi_new_device);
 static void spi_of_register_slaves(struct spi_controller *ctrl)
 {
 	struct device_node *n;
-	struct spi_board_info chip;
 	struct property *reg;
 	struct device_node *node = ctrl->dev->of_node;
 
@@ -119,7 +118,8 @@ static void spi_of_register_slaves(struct spi_controller *ctrl)
 		return;
 
 	for_each_available_child_of_node(node, n) {
-		memset(&chip, 0, sizeof(chip));
+		struct spi_board_info chip = {};
+
 		chip.name = xstrdup(n->name);
 		chip.bus_num = ctrl->bus_num;
 		/* Mode (clock phase/polarity/etc.) */
-- 
2.30.2




  parent reply	other threads:[~2023-03-10  9:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  9:42 [PATCH v3 0/7] support overlays to the barebox live tree Sascha Hauer
2023-03-10  9:42 ` [PATCH v3 1/7] kbuild: Add target to build dtb overlay files Sascha Hauer
2023-03-10  9:42 ` [PATCH v3 2/7] driver: Add rescan hook to struct device Sascha Hauer
2023-03-10  9:42 ` [PATCH v3 3/7] i2c: implement rescan Sascha Hauer
2023-03-10  9:42 ` [PATCH v3 4/7] spi: Directly register SPI device Sascha Hauer
2023-03-10  9:42 ` Sascha Hauer [this message]
2023-03-10  9:42 ` [PATCH v3 6/7] spi: implement rescan Sascha Hauer
2023-03-10  9:42 ` [PATCH v3 7/7] of_overlay: Add option to apply overlay to live tree Sascha Hauer
2023-03-14 14:59   ` Michael Riesch
2023-03-14 15:49     ` Sascha Hauer
2023-03-14 16:03       ` Michael Riesch
2023-03-15 16:09 ` [PATCH v3 0/7] support overlays to the barebox " Michael Riesch
2023-03-16  8:58   ` Sascha Hauer

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=20230310094222.2538259-6-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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