netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Kejian Yan <yankejian@huawei.com>,
	rjw@rjwysocki.net, lenb@kernel.org, davem@davemloft.net
Cc: fengguang.wu@intel.com, andrew@lunn.ch, ivecera@redhat.com,
	f.fainelli@gmail.com, haifeng.wei@huawei.com,
	charles.chenxin@huawei.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [patch v2 net-next 12/13] net: hns: implement the miscellaneous operation by asl
Date: Mon, 30 May 2016 11:25:56 +0300	[thread overview]
Message-ID: <1464596756.27624.51.camel@linux.intel.com> (raw)
In-Reply-To: <1464574222-69608-13-git-send-email-yankejian@huawei.com>

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

  reply	other threads:[~2016-05-30  8:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  2:10 [patch v2 net-next 00/13] net: hns: add support of ACPI Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 01/13] ACPI: bus: add stub acpi_dev_found() to linux/acpi.h Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 02/13] ACPI: bus: add stub acpi_evaluate_dsm() " Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 03/13] net: hisilicon: cleanup to prepare for other cases Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 04/13] net: hisilicon: add support of acpi for hns-mdio Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 05/13] net: hns: use device_* APIs instead of of_* APIs Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 06/13] net: hns: use platform_get_irq instead of irq_of_parse_and_map Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 07/13] net: hns: enet specify a reference to dsaf by fwnode_handle Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 08/13] net: hns: add uniform interface for phy connection Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 09/13] net: hns: add dsaf misc operation method Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 10/13] net: hns: dsaf adds support of acpi Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 11/13] net: hns: register phy device in each mac initial sequence Kejian Yan
2016-05-30  2:10 ` [patch v2 net-next 12/13] net: hns: implement the miscellaneous operation by asl Kejian Yan
2016-05-30  8:25   ` Andy Shevchenko [this message]
2016-05-30  2:10 ` [patch v2 net-next 13/13] net: hns: net: hns: enet adds support of acpi Kejian Yan
2016-05-30  8:28 ` [patch v2 net-next 00/13] net: hns: add support of ACPI Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464596756.27624.51.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andrew@lunn.ch \
    --cc=charles.chenxin@huawei.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=haifeng.wei@huawei.com \
    --cc=ivecera@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=yankejian@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).