summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2023-03-07 15:15:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-03-10 10:28:37 +0100
commit0aa0204cf3b2e63f4c546f3bfd02835d70e99007 (patch)
treeeafb22be1a24aa0f19f078b221dab581e3b66f12 /drivers/spi/spi.c
parent9291707309593944f94d2dc314c8ebef074b00d3 (diff)
downloadbarebox-0aa0204cf3b2e63f4c546f3bfd02835d70e99007.tar.gz
barebox-0aa0204cf3b2e63f4c546f3bfd02835d70e99007.tar.xz
spi: reduce scope of 'chip'
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>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c4
1 files 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.) */