lkml.org 
[lkml]   [2012]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir
On Sat, Apr 21, 2012 at 06:18:25PM +0800, yan wrote:
> create_dir will call sysfs_create_dir and then populate_dir.
> If ktype of kobject is null, sysfs_craete_dir will lead to
> oops first. There is no need to check ktype in populate_dir.
>
> Signed-off-by: Yan Hong <clouds.yan@gmail.com>
> ---
> lib/kobject.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/kobject.c b/lib/kobject.c
> index bc05922..85d5e9b 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -34,7 +34,7 @@ static int populate_dir(struct kobject *kobj)
> int error = 0;
> int i;
>
> - if (t && t->default_attrs) {
> + if (t->default_attrs) {

I don't know, I think I'd like to keep this check for now, as it was put
there for a reason. Yes, it's a reason lost to the sands of time, but
is it costing us anything if it is still there?

greg k-h


\
 
 \ /
  Last update: 2012-04-23 22:45    [W:0.034 / U:50.396 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site