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 <[email protected]> --- 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
