Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1408856
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [patch v2 net-next 12/13] net: hns: implement the miscellaneous operation by asl |
| Date | 2016-05-30 10:30 +0200 |
| Message-ID | <rEqKe-1Gi-17@gated-at.bofh.it> (permalink) |
| References | <rEkEN-5XN-3@gated-at.bofh.it> <rEkOt-6ij-5@gated-at.bofh.it> |
| Organization | Intel Finland Oy |
On Mon, 2016-05-30 at 10:10 +0800, Kejian Yan wrote:
> The miscellaneous operation is implemented in BIOS, the kernel can
> call
> _DSM method help to call the implementation in ACPI case. Here is a
> patch
> to do that.
>
> +static phy_interface_t hns_mac_get_phy_if_acpi(struct hns_mac_cb
> *mac_cb)
> +{
> + phy_interface_t phy_if = PHY_INTERFACE_MODE_NA;
> + union acpi_object *obj;
> + union acpi_object obj_args, argv4;
> +
> + obj_args.integer.type = ACPI_TYPE_INTEGER;
> + obj_args.integer.value = mac_cb->mac_id;
> +
> + argv4.type = ACPI_TYPE_PACKAGE,
> + argv4.package.count = 1,
> + argv4.package.elements = &obj_args,
> +
> + obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
> + hns_dsaf_acpi_dsm_uuid, 0,
> + HNS_OP_GET_PORT_TYPE_FUNC, &argv4);
> +
> + if (!obj || obj->type != ACPI_TYPE_INTEGER)
Seems you have potential memory leak here
if (!obj)
return phy_if;
if (obj->...)
goto exit_free;
> + return phy_if;
> +
> + phy_if = obj->integer.value ?
> + PHY_INTERFACE_MODE_XGMII : PHY_INTERFACE_MODE_SGMII;
> +
> + dev_dbg(mac_cb->dev, "mac_id=%d, phy_if=%d\n", mac_cb-
> >mac_id, phy_if);
> +
+ exit_free:
> + ACPI_FREE(obj);
> +
> + return phy_if;
> +}
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[patch v2 net-next 12/13] net: hns: implement the miscellaneous operation by asl Kejian Yan <yankejian@huawei.com> - 2016-05-30 04:10 +0200 Re: [patch v2 net-next 12/13] net: hns: implement the miscellaneous operation by asl Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-05-30 10:30 +0200
csiph-web