* [PATCH] staging: fbtft: replace -1 with proper error codes
@ 2026-02-28 20:27 Soham Kute
2026-03-09 16:27 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Soham Kute @ 2026-02-28 20:27 UTC (permalink / raw)
To: andy, gregkh
Cc: dri-devel, linux-fbdev, linux-staging, linux-kernel, Soham Kute
Replace return -1 with proper kernel error codes:
- -ENODEV when SPI device is NULL
- -EINVAL when display size or buffer is invalid
- -EOPNOTSUPP for unimplemented functions
Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
---
drivers/staging/fbtft/fb_ra8875.c | 4 ++--
drivers/staging/fbtft/fbtft-bus.c | 4 ++--
drivers/staging/fbtft/fbtft-io.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c
index 0ab1de6647d0..c2e5c6276415 100644
--- a/drivers/staging/fbtft/fb_ra8875.c
+++ b/drivers/staging/fbtft/fb_ra8875.c
@@ -29,7 +29,7 @@ static int write_spi(struct fbtft_par *par, void *buf, size_t len)
if (!par->spi) {
dev_err(par->info->device,
"%s: par->spi is unexpectedly NULL\n", __func__);
- return -1;
+ return -ENODEV;
}
spi_message_init(&m);
@@ -144,7 +144,7 @@ static int init_display(struct fbtft_par *par)
write_reg(par, 0x1F, 0x01);
} else {
dev_err(par->info->device, "display size is not supported!!");
- return -1;
+ return -EINVAL;
}
/* PWM clock */
diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 30e436ff19e4..9a87bddd7d19 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -181,7 +181,7 @@ int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len)
if (!par->txbuf.buf) {
dev_err(par->info->device, "%s: txbuf.buf is NULL\n", __func__);
- return -1;
+ return -EINVAL;
}
remain = len;
@@ -217,7 +217,7 @@ EXPORT_SYMBOL(fbtft_write_vmem16_bus9);
int fbtft_write_vmem8_bus8(struct fbtft_par *par, size_t offset, size_t len)
{
dev_err(par->info->device, "%s: function not implemented\n", __func__);
- return -1;
+ return -EOPNOTSUPP;
}
EXPORT_SYMBOL(fbtft_write_vmem8_bus8);
diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c
index de1904a443c2..2144f5257fa9 100644
--- a/drivers/staging/fbtft/fbtft-io.c
+++ b/drivers/staging/fbtft/fbtft-io.c
@@ -19,7 +19,7 @@ int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len)
if (!par->spi) {
dev_err(par->info->device,
"%s: par->spi is unexpectedly NULL\n", __func__);
- return -1;
+ return -ENODEV;
}
spi_message_init(&m);
@@ -231,6 +231,6 @@ EXPORT_SYMBOL(fbtft_write_gpio16_wr);
int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len)
{
dev_err(par->info->device, "%s: function not implemented\n", __func__);
- return -1;
+ return -EOPNOTSUPP;
}
EXPORT_SYMBOL(fbtft_write_gpio16_wr_latched);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging: fbtft: replace -1 with proper error codes
2026-02-28 20:27 [PATCH] staging: fbtft: replace -1 with proper error codes Soham Kute
@ 2026-03-09 16:27 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-03-09 16:27 UTC (permalink / raw)
To: Soham Kute; +Cc: andy, dri-devel, linux-fbdev, linux-staging, linux-kernel
On Sun, Mar 01, 2026 at 01:57:01AM +0530, Soham Kute wrote:
> Replace return -1 with proper kernel error codes:
> - -ENODEV when SPI device is NULL
> - -EINVAL when display size or buffer is invalid
> - -EOPNOTSUPP for unimplemented functions
>
> Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
> ---
> drivers/staging/fbtft/fb_ra8875.c | 4 ++--
> drivers/staging/fbtft/fbtft-bus.c | 4 ++--
> drivers/staging/fbtft/fbtft-io.c | 4 ++--
> 3 files changed, 6 insertions(+), 6 deletions(-)
Some of these functions are not called anywhere, so please remove them
instead entirely, and then fix up the remaining ones (after verifying
that the callers can handle the changed values you have made here.)
That can be a patch series.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-09 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28 20:27 [PATCH] staging: fbtft: replace -1 with proper error codes Soham Kute
2026-03-09 16:27 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox