[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190528080214.18382-2-maowenan@huawei.com>
Date: Tue, 28 May 2019 16:02:13 +0800
From: Mao Wenan <maowenan@...wei.com>
To: <gregkh@...uxfoundation.org>, <jeremy@...zel.net>
CC: <thesven73@...il.com>, <devel@...verdev.osuosl.org>,
<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>,
<matt.sickler@...tronics.com>, Mao Wenan <maowenan@...wei.com>
Subject: [PATCH -next v3 1/2] staging: kpc2000: report error status to spi core
There is an error condition that's not reported to
the spi core in kp_spi_transfer_one_message().
It should restore status value to m->status, and
return it in error path.
Signed-off-by: Mao Wenan <maowenan@...wei.com>
---
drivers/staging/kpc2000/kpc2000_spi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 075ae4fafa7d..628a447642ad 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -374,7 +374,7 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
list_for_each_entry(transfer, &m->transfers, transfer_list) {
if (transfer->tx_buf == NULL && transfer->rx_buf == NULL && transfer->len) {
status = -EINVAL;
- break;
+ goto error;
}
/* transfer */
@@ -412,7 +412,7 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
if (count != transfer->len) {
status = -EIO;
- break;
+ goto error;
}
}
@@ -430,6 +430,10 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
/* done work */
spi_finalize_current_message(master);
return 0;
+
+ error:
+ m->status = status;
+ return status;
}
static void
--
2.20.1
Powered by blists - more mailing lists