* [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir
@ 2012-04-21 10:18 yan
2012-04-23 20:43 ` greg
0 siblings, 1 reply; 2+ messages in thread
From: yan @ 2012-04-21 10:18 UTC (permalink / raw)
To: greg; +Cc: kernel, message
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) {
for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
error = sysfs_create_file(kobj, attr);
if (error)
--
1.7.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir
2012-04-21 10:18 [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir yan
@ 2012-04-23 20:43 ` greg
0 siblings, 0 replies; 2+ messages in thread
From: greg @ 2012-04-23 20:43 UTC (permalink / raw)
To: yan; +Cc: kernel, message
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-23 20:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21 10:18 [PATCH][Trivial] lib/kobject.c: Remove redundant check in populate_dir yan
2012-04-23 20:43 ` greg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).