diff mbox

[v2,3/3] spi: allow registering empty spi_board_info lists

Message ID 20170228041857.13292-4-dmitry.torokhov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Torokhov Feb. 28, 2017, 4:18 a.m. UTC
Many boards form list of spi_board_info entries depending on config,
and it is possible to end up with empty list. Do not report error
in such cases.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/spi/spi.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Andy Shevchenko Feb. 28, 2017, 2:01 p.m. UTC | #1
On Tue, Feb 28, 2017 at 6:18 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Many boards form list of spi_board_info entries depending on config,
> and it is possible to end up with empty list. Do not report error
> in such cases.

If there is an actual case already it would be better to make the
patch first in the series with Cc: stable@.

FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Dmitry Torokhov Feb. 28, 2017, 6:26 p.m. UTC | #2
On Tue, Feb 28, 2017 at 04:01:46PM +0200, Andy Shevchenko wrote:
> On Tue, Feb 28, 2017 at 6:18 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > Many boards form list of spi_board_info entries depending on config,
> > and it is possible to end up with empty list. Do not report error
> > in such cases.
> 
> If there is an actual case already it would be better to make the
> patch first in the series with Cc: stable@.

arch/blackfin/mach-bf533/boards/ezkit.c: you can get config convoluted
enough so that you'll end up with empty array. But nobody checks the
result of the call, so the failure is not visible. There is no need to
cc stable@ for this.

> 
> FWIW:
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 

Thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1b66e0497327..dbc4f00dc2fc 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -683,9 +683,6 @@  int spi_register_board_info(struct spi_board_info const *info, unsigned n)
 	struct boardinfo *bi;
 	int i;
 
-	if (!n)
-		return -EINVAL;
-
 	for (i = 0; i < n; i++, info++) {
 		struct spi_master *master;