mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <eagle.alexander923@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [PATCH] mtd: mtdraw: fix return type of erase stub
Date: Mon, 30 Nov 2026 16:44:47 +0300	[thread overview]
Message-ID: <20261130134447.892879-1-eagle.alexander923@gmail.com> (raw)

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




                 reply	other threads:[~2026-11-30 13:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130134447.892879-1-eagle.alexander923@gmail.com \
    --to=eagle.alexander923@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox