Skip to content

RFC kobject_set_name - error handling

Maneesh Soni lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kobject_set_name - error handlingdrivers/base/bus.c drivers/base/sys.c+13 -46 replies
2/2kobject_set_name - error handlingdrivers/base/class.c fs/sysfs/dir.c include/linux/kobject.h +3 more+29 -171 reply
2/2sysfs_rename_dir-cleanupdrivers/base/class.c fs/sysfs/dir.c include/linux/kobject.h +3 more+32 -184 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/2] kobject_set_name - error handling

IMO error handling/propogation is incorrect or not there in most of the places in the users of kobject_set_name. sysfs_rename_dir is one of them.

1) sysfs_rename_dir ignores return code from kobject_set_name, and returns void
2) kobject_rename returns void
3) dev_change_name ignore return code from class_device_rename.

This can lead to mismatch in kobject name and the directory name. Now correcting this will involve changing the APIs at this point of time. Luckily we have just one user of sysfs_rename_dir as of now.

Like this there are 14 other users of kobject_set_name and only one checks the return code. Out of them atleast following are problematic IMO.

bus_add_driver()
bus_register()
sys_dev_register()
sysfs_rename_dir()

Others are not because we have name length less than KOBJ_NAME_LEN and there will be no allocation. I have corrected the above problems in the following two patches.

Please comment.

Thanks,
Maneesh

Signature · 6 lines
Maneesh Soni
Linux Technology Center, 
IBM Software Lab, Bangalore, India
email: [email protected]
Phone: 91-80-25044999 Fax: 91-80-25268553
T/L : 9243696