mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: mtdraw: fix return type of erase stub
@ 2026-11-30 13:44 Alexander Shiyan
  0 siblings, 0 replies; only message in thread
From: Alexander Shiyan @ 2026-11-30 13:44 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

When CONFIG_MTD_WRITE is disabled, mtdraw_erase() is provided as a stub
that is assigned to struct cdev_operations::erase, which expects an int
return value. The stub was declared as returning ssize_t, which makes the
assignment of the function pointer incompatible:

  drivers/mtd/mtdraw.c:274:26: error: initialization of
  'int (*)(struct cdev *, loff_t,  loff_t)' from incompatible pointer
  type 'ssize_t (*)(struct cdev *, loff_t,  loff_t)' [-Werror=
  incompatible-pointer-types]

Return int like the real implementation does.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/mtd/mtdraw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index b284d92ed3..5f453ed71a 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -271,7 +271,7 @@ static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
 {
 	return 0;
 }
-static ssize_t mtdraw_erase(struct cdev *cdev, loff_t count, loff_t offset)
+static int mtdraw_erase(struct cdev *cdev, loff_t count, loff_t offset)
 {
 	return 0;
 }
-- 
2.56.1




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 13:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 13:44 [PATCH] mtd: mtdraw: fix return type of erase stub Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox