* [PATCH] staging: gpib: use int instead of u32 to store error codes
@ 2025-08-26 9:58 Qianfeng Rong
2025-08-26 10:19 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Qianfeng Rong @ 2025-08-26 9:58 UTC (permalink / raw)
To: Dave Penkler, Greg Kroah-Hartman, Michael Rubin, Dan Carpenter,
Arnd Bergmann, linux-staging, linux-kernel
Cc: Qianfeng Rong
Use int instead of size_t for 'ret' variable to store negative error codes
returned by bb_write().
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/staging/gpib/gpio/gpib_bitbang.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c
index 22a55f3f794d..374cd61355e9 100644
--- a/drivers/staging/gpib/gpio/gpib_bitbang.c
+++ b/drivers/staging/gpib/gpio/gpib_bitbang.c
@@ -726,7 +726,7 @@ static irqreturn_t bb_SRQ_interrupt(int irq, void *arg)
static int bb_command(struct gpib_board *board, u8 *buffer,
size_t length, size_t *bytes_written)
{
- size_t ret;
+ int ret;
struct bb_priv *priv = board->private_data;
int i;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] staging: gpib: use int instead of u32 to store error codes
2025-08-26 9:58 [PATCH] staging: gpib: use int instead of u32 to store error codes Qianfeng Rong
@ 2025-08-26 10:19 ` Dan Carpenter
2025-08-26 11:49 ` Qianfeng Rong
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2025-08-26 10:19 UTC (permalink / raw)
To: Qianfeng Rong
Cc: Dave Penkler, Greg Kroah-Hartman, Michael Rubin, Arnd Bergmann,
linux-staging, linux-kernel
On Tue, Aug 26, 2025 at 05:58:59PM +0800, Qianfeng Rong wrote:
> Use int instead of size_t for 'ret' variable to store negative error codes
> returned by bb_write().
>
The commit message needs to give a motivation. I would have assumed from
reading the patch that this caused a signedness bug but it doesn't.
The commit has no effect on runtime but fixing the type is a nice
cleanup. My commit message would say:
The "ret" variable is used to store the return from bb_write() returns
either zero on success or negative error codes on failure. Storing the
error codes in size_t which is an unsigned long, doesn't cause an issue
at runtime but it's ugly as pants. Change "ret" from size_t to int
type. No effect on runtime.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: gpib: use int instead of u32 to store error codes
2025-08-26 10:19 ` Dan Carpenter
@ 2025-08-26 11:49 ` Qianfeng Rong
0 siblings, 0 replies; 3+ messages in thread
From: Qianfeng Rong @ 2025-08-26 11:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Dave Penkler, Greg Kroah-Hartman, Michael Rubin, Arnd Bergmann,
linux-staging, linux-kernel
在 2025/8/26 18:19, Dan Carpenter 写道:
> On Tue, Aug 26, 2025 at 05:58:59PM +0800, Qianfeng Rong wrote:
>> Use int instead of size_t for 'ret' variable to store negative error codes
>> returned by bb_write().
>>
> The commit message needs to give a motivation. I would have assumed from
> reading the patch that this caused a signedness bug but it doesn't.
> The commit has no effect on runtime but fixing the type is a nice
> cleanup. My commit message would say:
>
> The "ret" variable is used to store the return from bb_write() returns
> either zero on success or negative error codes on failure. Storing the
> error codes in size_t which is an unsigned long, doesn't cause an issue
> at runtime but it's ugly as pants. Change "ret" from size_t to int
> type. No effect on runtime.
Thanks very much for the detailed comments. I will send v2 with a commit
message similar to the one you suggested.
Best regards,
Qianfeng
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-26 11:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 9:58 [PATCH] staging: gpib: use int instead of u32 to store error codes Qianfeng Rong
2025-08-26 10:19 ` Dan Carpenter
2025-08-26 11:49 ` Qianfeng Rong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox