* [PATCH] driver core: drop __must_check from driver_for_each_device
@ 2024-08-20 9:00 Heiner Kallweit
2024-08-20 13:31 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2024-08-20 9:00 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Linux Kernel Mailing List
There are several users of driver_for_each_device where the worker
function doesn't actually have a return value. One example is
__igb_notify_dca(). This results in dead code just to make __must_check
happy. So drop this annotation.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
include/linux/device/driver.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index 1fc8b6878..aed40242f 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -153,8 +153,8 @@ void driver_remove_file(const struct device_driver *driver,
int driver_set_override(struct device *dev, const char **override,
const char *s, size_t len);
-int __must_check driver_for_each_device(struct device_driver *drv, struct device *start,
- void *data, int (*fn)(struct device *dev, void *));
+int driver_for_each_device(struct device_driver *drv, struct device *start,
+ void *data, int (*fn)(struct device *dev, void *));
struct device *driver_find_device(const struct device_driver *drv,
struct device *start, const void *data,
int (*match)(struct device *dev, const void *data));
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: drop __must_check from driver_for_each_device
2024-08-20 9:00 [PATCH] driver core: drop __must_check from driver_for_each_device Heiner Kallweit
@ 2024-08-20 13:31 ` Greg Kroah-Hartman
2024-08-20 15:24 ` Heiner Kallweit
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2024-08-20 13:31 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Rafael J. Wysocki, Linux Kernel Mailing List
On Tue, Aug 20, 2024 at 11:00:29AM +0200, Heiner Kallweit wrote:
> There are several users of driver_for_each_device where the worker
> function doesn't actually have a return value. One example is
> __igb_notify_dca(). This results in dead code just to make __must_check
> happy. So drop this annotation.
No, that code looks correct, the only "odd" thing is that it's a
notifier callback and so it requires a different translation of an error
message.
Personally, attempting for a driver to iterate over all devices assigned
to it just to print out a kernel log message seems like the big abuse
here, why is any of that needed at all? Ah, that's a side affect of the
dca api there. Ok, still looks correct, I don't see a problem.
Ignoring error values is not a good idea, let's not make it simple to do
so.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver core: drop __must_check from driver_for_each_device
2024-08-20 13:31 ` Greg Kroah-Hartman
@ 2024-08-20 15:24 ` Heiner Kallweit
0 siblings, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2024-08-20 15:24 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Rafael J. Wysocki, Linux Kernel Mailing List
On 20.08.2024 15:31, Greg Kroah-Hartman wrote:
> On Tue, Aug 20, 2024 at 11:00:29AM +0200, Heiner Kallweit wrote:
>> There are several users of driver_for_each_device where the worker
>> function doesn't actually have a return value. One example is
>> __igb_notify_dca(). This results in dead code just to make __must_check
>> happy. So drop this annotation.
>
> No, that code looks correct, the only "odd" thing is that it's a
> notifier callback and so it requires a different translation of an error
> message.
>
> Personally, attempting for a driver to iterate over all devices assigned
> to it just to print out a kernel log message seems like the big abuse
> here, why is any of that needed at all? Ah, that's a side affect of the
> dca api there. Ok, still looks correct, I don't see a problem.
>
__igb_notify_dca() always returns 0, for other worker functions of
driver_for_each_device it's the same. So we have several cases where
driver_for_each_device always returns 0. Then I think it doesn't make
sense to urge the caller to check the return value.
> Ignoring error values is not a good idea, let's not make it simple to do
> so.
>
> thanks,
>
> greg k-h
Heiner
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-20 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 9:00 [PATCH] driver core: drop __must_check from driver_for_each_device Heiner Kallweit
2024-08-20 13:31 ` Greg Kroah-Hartman
2024-08-20 15:24 ` Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox