Re: [PATCH v2] driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute

From: Greg Kroah-Hartman
Date: Wed Jul 24 2024 - 10:06:38 EST


On Wed, Jul 24, 2024 at 09:54:48PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>
> Return -EIO instead of 0 for below erroneous bus attribute operations:
> - read a bus attribute without show().
> - write a bus attribute without store().
>
> Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
> ---
> Changes in v2:
> - Correct commit messages and add inline comments
> - The following commit have similar change
> Commit: 4a0c20bf8c0f ("[PATCH] sysfs: (driver/base) if show/store is missing return -EIO")
> - Link to v1: https://lore.kernel.org/r/20240723-bus_fix-v1-1-175f926805dc@xxxxxxxxxxx
> ---
> drivers/base/bus.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)

Again, how was this tested?

thanks,

greg k-h