diff options
-rw-r--r-- | drivers/spi/spi.c | 4 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 1771b2456bfa..ecca4a6a6f94 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -218,6 +218,8 @@ struct spi_device *spi_new_device(struct spi_master *master, | |||
218 | if (!spi_master_get(master)) | 218 | if (!spi_master_get(master)) |
219 | return NULL; | 219 | return NULL; |
220 | 220 | ||
221 | WARN_ON(strlen(chip->modalias) >= sizeof(proxy->modalias)); | ||
222 | |||
221 | proxy = kzalloc(sizeof *proxy, GFP_KERNEL); | 223 | proxy = kzalloc(sizeof *proxy, GFP_KERNEL); |
222 | if (!proxy) { | 224 | if (!proxy) { |
223 | dev_err(dev, "can't alloc dev for cs%d\n", | 225 | dev_err(dev, "can't alloc dev for cs%d\n", |
@@ -229,7 +231,7 @@ struct spi_device *spi_new_device(struct spi_master *master, | |||
229 | proxy->max_speed_hz = chip->max_speed_hz; | 231 | proxy->max_speed_hz = chip->max_speed_hz; |
230 | proxy->mode = chip->mode; | 232 | proxy->mode = chip->mode; |
231 | proxy->irq = chip->irq; | 233 | proxy->irq = chip->irq; |
232 | proxy->modalias = chip->modalias; | 234 | strlcpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias)); |
233 | 235 | ||
234 | snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id, | 236 | snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id, |
235 | "%s.%u", master->dev.bus_id, | 237 | "%s.%u", master->dev.bus_id, |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index b9a76c972084..a9cc29d46653 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -82,7 +82,7 @@ struct spi_device { | |||
82 | int irq; | 82 | int irq; |
83 | void *controller_state; | 83 | void *controller_state; |
84 | void *controller_data; | 84 | void *controller_data; |
85 | const char *modalias; | 85 | char modalias[32]; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * likely need more hooks for more protocol options affecting how | 88 | * likely need more hooks for more protocol options affecting how |