* [bug report] iwlwifi: Add support for SAR South Korea limitation
@ 2019-08-06 14:24 Dan Carpenter
2019-08-06 14:30 ` Dan Carpenter
2019-08-23 8:47 ` Luciano Coelho
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-08-06 14:24 UTC (permalink / raw)
To: haim.dreyfuss; +Cc: linux-wireless
Hello Haim Dreyfuss,
The patch 0c3d7282233c: "iwlwifi: Add support for SAR South Korea
limitation" from Feb 27, 2019, leads to the following static checker
warning:
drivers/net/wireless/intel/iwlwifi/fw/acpi.c:166 iwl_acpi_get_mcc()
warn: passing a valid pointer to 'PTR_ERR'
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
153 int iwl_acpi_get_mcc(struct device *dev, char *mcc)
154 {
155 union acpi_object *wifi_pkg, *data;
156 u32 mcc_val;
157 int ret, tbl_rev;
158
159 data = iwl_acpi_get_object(dev, ACPI_WRDD_METHOD);
160 if (IS_ERR(data))
161 return PTR_ERR(data);
162
163 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE,
164 &tbl_rev);
165 if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
^^^^^^^^^^^^
wifi_pkg is not a valid error code. Also it feels like it might be more
future proof to blacklist rev 1 instead of whitelisting rev 0.
166 ret = PTR_ERR(wifi_pkg);
167 goto out_free;
168 }
169
170 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
171 ret = -EINVAL;
172 goto out_free;
173 }
174
175 mcc_val = wifi_pkg->package.elements[1].integer.value;
176
177 mcc[0] = (mcc_val >> 8) & 0xff;
178 mcc[1] = mcc_val & 0xff;
179 mcc[2] = '\0';
180
181 ret = 0;
182 out_free:
183 kfree(data);
184 return ret;
185 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] iwlwifi: Add support for SAR South Korea limitation
2019-08-06 14:24 [bug report] iwlwifi: Add support for SAR South Korea limitation Dan Carpenter
@ 2019-08-06 14:30 ` Dan Carpenter
2019-08-23 8:47 ` Luciano Coelho
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-08-06 14:30 UTC (permalink / raw)
To: haim.dreyfuss; +Cc: linux-wireless
Oops. There are a couple other related warnings as well.
drivers/net/wireless/intel/iwlwifi/fw/acpi.c:166 iwl_acpi_get_mcc() warn: passing a valid pointer to 'PTR_ERR'
drivers/net/wireless/intel/iwlwifi/fw/acpi.c:228 iwl_acpi_get_eckv() warn: passing a valid pointer to 'PTR_ERR'
drivers/net/wireless/intel/iwlwifi/mvm/fw.c:696 iwl_mvm_sar_get_wrds_table() warn: passing a valid pointer to 'PTR_ERR'
drivers/net/wireless/intel/iwlwifi/mvm/fw.c:733 iwl_mvm_sar_get_ewrd_table() warn: passing a valid pointer to 'PTR_ERR'
drivers/net/wireless/intel/iwlwifi/mvm/fw.c:793 iwl_mvm_sar_get_wgds_table() warn: passing a valid pointer to 'PTR_ERR'
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bug report] iwlwifi: Add support for SAR South Korea limitation
2019-08-06 14:24 [bug report] iwlwifi: Add support for SAR South Korea limitation Dan Carpenter
2019-08-06 14:30 ` Dan Carpenter
@ 2019-08-23 8:47 ` Luciano Coelho
1 sibling, 0 replies; 3+ messages in thread
From: Luciano Coelho @ 2019-08-23 8:47 UTC (permalink / raw)
To: Dan Carpenter, haim.dreyfuss; +Cc: linux-wireless
Hi Dan,
On Tue, 2019-08-06 at 17:24 +0300, Dan Carpenter wrote:
> Hello Haim Dreyfuss,
>
> The patch 0c3d7282233c: "iwlwifi: Add support for SAR South Korea
> limitation" from Feb 27, 2019, leads to the following static checker
> warning:
>
> drivers/net/wireless/intel/iwlwifi/fw/acpi.c:166 iwl_acpi_get_mcc()
> warn: passing a valid pointer to 'PTR_ERR'
>
> drivers/net/wireless/intel/iwlwifi/fw/acpi.c
> 153 int iwl_acpi_get_mcc(struct device *dev, char *mcc)
> 154 {
> 155 union acpi_object *wifi_pkg, *data;
> 156 u32 mcc_val;
> 157 int ret, tbl_rev;
> 158
> 159 data = iwl_acpi_get_object(dev, ACPI_WRDD_METHOD);
> 160 if (IS_ERR(data))
> 161 return PTR_ERR(data);
> 162
> 163 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE,
> 164 &tbl_rev);
> 165 if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
> ^^^^^^^^^^^^
> wifi_pkg is not a valid error code. Also it feels like it might be more
> future proof to blacklist rev 1 instead of whitelisting rev 0.
Yeah, this code is wrong. If wifi_pkg is valid but tbl_rev is != 0,
then we will return a valid pointer instead of an error. I'll fix
this.
But regarding blacklisting one, I think it's better as it is. We mean
that the only revision we support is 0, if we get 1 or higher, we
return -EINVAL, because we handle it. When we add support for other
revisions, we need to change it.
> 166 ret = PTR_ERR(wifi_pkg);
> 167 goto out_free;
> 168 }
Thanks for reporting!
(and yeah, I'll handle the other occurrences you mentioned too).
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-23 8:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06 14:24 [bug report] iwlwifi: Add support for SAR South Korea limitation Dan Carpenter
2019-08-06 14:30 ` Dan Carpenter
2019-08-23 8:47 ` Luciano Coelho
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).