@@ -70,16 +70,16 @@ static inline struct acpi_table_header *get_header(struct config_item *cfg)
70
70
if (!table -> header )
71
71
pr_err ("table not loaded\n" );
72
72
73
- return table -> header ;
73
+ return table -> header ?: ERR_PTR ( - EINVAL ) ;
74
74
}
75
75
76
76
static ssize_t acpi_table_aml_read (struct config_item * cfg ,
77
77
void * data , size_t size )
78
78
{
79
79
struct acpi_table_header * h = get_header (cfg );
80
80
81
- if (! h )
82
- return - EINVAL ;
81
+ if (IS_ERR ( h ) )
82
+ return PTR_ERR ( h ) ;
83
83
84
84
if (data )
85
85
memcpy (data , h , h -> length );
@@ -100,8 +100,8 @@ static ssize_t acpi_table_signature_show(struct config_item *cfg, char *str)
100
100
{
101
101
struct acpi_table_header * h = get_header (cfg );
102
102
103
- if (! h )
104
- return - EINVAL ;
103
+ if (IS_ERR ( h ) )
104
+ return PTR_ERR ( h ) ;
105
105
106
106
return sysfs_emit (str , "%.*s\n" , ACPI_NAMESEG_SIZE , h -> signature );
107
107
}
@@ -110,8 +110,8 @@ static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
110
110
{
111
111
struct acpi_table_header * h = get_header (cfg );
112
112
113
- if (! h )
114
- return - EINVAL ;
113
+ if (IS_ERR ( h ) )
114
+ return PTR_ERR ( h ) ;
115
115
116
116
return sysfs_emit (str , "%d\n" , h -> length );
117
117
}
@@ -120,8 +120,8 @@ static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
120
120
{
121
121
struct acpi_table_header * h = get_header (cfg );
122
122
123
- if (! h )
124
- return - EINVAL ;
123
+ if (IS_ERR ( h ) )
124
+ return PTR_ERR ( h ) ;
125
125
126
126
return sysfs_emit (str , "%d\n" , h -> revision );
127
127
}
@@ -130,8 +130,8 @@ static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
130
130
{
131
131
struct acpi_table_header * h = get_header (cfg );
132
132
133
- if (! h )
134
- return - EINVAL ;
133
+ if (IS_ERR ( h ) )
134
+ return PTR_ERR ( h ) ;
135
135
136
136
return sysfs_emit (str , "%.*s\n" , ACPI_OEM_ID_SIZE , h -> oem_id );
137
137
}
@@ -140,8 +140,8 @@ static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
140
140
{
141
141
struct acpi_table_header * h = get_header (cfg );
142
142
143
- if (! h )
144
- return - EINVAL ;
143
+ if (IS_ERR ( h ) )
144
+ return PTR_ERR ( h ) ;
145
145
146
146
return sysfs_emit (str , "%.*s\n" , ACPI_OEM_TABLE_ID_SIZE , h -> oem_table_id );
147
147
}
@@ -150,8 +150,8 @@ static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
150
150
{
151
151
struct acpi_table_header * h = get_header (cfg );
152
152
153
- if (! h )
154
- return - EINVAL ;
153
+ if (IS_ERR ( h ) )
154
+ return PTR_ERR ( h ) ;
155
155
156
156
return sysfs_emit (str , "%d\n" , h -> oem_revision );
157
157
}
@@ -161,8 +161,8 @@ static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
161
161
{
162
162
struct acpi_table_header * h = get_header (cfg );
163
163
164
- if (! h )
165
- return - EINVAL ;
164
+ if (IS_ERR ( h ) )
165
+ return PTR_ERR ( h ) ;
166
166
167
167
return sysfs_emit (str , "%.*s\n" , ACPI_NAMESEG_SIZE , h -> asl_compiler_id );
168
168
}
@@ -172,8 +172,8 @@ static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
172
172
{
173
173
struct acpi_table_header * h = get_header (cfg );
174
174
175
- if (! h )
176
- return - EINVAL ;
175
+ if (IS_ERR ( h ) )
176
+ return PTR_ERR ( h ) ;
177
177
178
178
return sysfs_emit (str , "%d\n" , h -> asl_compiler_revision );
179
179
}
0 commit comments