All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hayes Wang <hayeswang@realtek.com>
To: Oliver Neukum <oneukum@suse.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [RFC] r8152: pass through needs to be singular
Date: Wed, 3 Aug 2022 03:48:55 +0000	[thread overview]
Message-ID: <0f5422bbeb7642f492b99e9ec1f07751@realtek.com> (raw)
In-Reply-To: <20220728191851.30402-1-oneukum@suse.com>

Oliver Neukum <oneukum@suse.com>
> Sent: Friday, July 29, 2022 3:19 AM
[...]
> @@ -1608,6 +1622,12 @@ static int vendor_mac_passthru_addr_read(struct
> r8152 *tp, struct sockaddr *sa)
>  	acpi_object_type mac_obj_type;
>  	int mac_strlen;
> 
> +	mutex_lock(&pass_through_lock);
> +
> +	if (!holder_of_pass_through) {
> +		ret = -EBUSY;
> +		goto failout;
> +	}

Excuse me. I have one question.
When is the holder_of_pass_through set?
The default value of holder_of_pass_through is NULL, so
it seems the holder_of_pass_through would never be set.

Best Regards,
Hayes

>  	if (tp->lenovo_macpassthru) {
>  		mac_obj_name = "\\MACA";
>  		mac_obj_type = ACPI_TYPE_STRING;
> @@ -1621,7 +1641,8 @@ static int vendor_mac_passthru_addr_read(struct
> r8152 *tp, struct sockaddr *sa)
>  			if ((ocp_data & PASS_THRU_MASK) != 1) {
>  				netif_dbg(tp, probe, tp->netdev,
>  						"No efuse for RTL8153-AD MAC pass through\n");
> -				return -ENODEV;
> +				ret = -ENODEV;
> +				goto failout;
>  			}
>  		} else {
>  			/* test for RTL8153-BND and RTL8153-BD */
> @@ -1629,7 +1650,8 @@ static int vendor_mac_passthru_addr_read(struct
> r8152 *tp, struct sockaddr *sa)
>  			if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK)
> == 0) {
>  				netif_dbg(tp, probe, tp->netdev,
>  						"Invalid variant for MAC pass through\n");
> -				return -ENODEV;
> +				ret = -ENODEV;
> +				goto failout;
>  			}
>  		}
> 
> @@ -1641,8 +1663,10 @@ static int vendor_mac_passthru_addr_read(struct
> r8152 *tp, struct sockaddr *sa)
>  	/* returns _AUXMAC_#AABBCCDDEEFF# */
>  	status = acpi_evaluate_object(NULL, mac_obj_name, NULL, &buffer);
>  	obj = (union acpi_object *)buffer.pointer;
> -	if (!ACPI_SUCCESS(status))
> -		return -ENODEV;
> +	if (!ACPI_SUCCESS(status)) {
> +		ret = -ENODEV;
> +		goto failout;
> +	}
>  	if (obj->type != mac_obj_type || obj->string.length != mac_strlen) {
>  		netif_warn(tp, probe, tp->netdev,
>  			   "Invalid buffer for pass-thru MAC addr: (%d, %d)\n",
> @@ -1670,6 +1694,10 @@ static int vendor_mac_passthru_addr_read(struct
> r8152 *tp, struct sockaddr *sa)
> 
>  amacout:
>  	kfree(obj);
> +failout:
> +	if (!ret)
> +		holder_of_pass_through = tp;
> +	mutex_unlock(&pass_through_lock);
>  	return ret;
>  }


  parent reply	other threads:[~2022-08-03  3:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 19:18 [RFC] r8152: pass through needs to be singular Oliver Neukum
2022-07-28 22:11 ` Andrew Lunn
2022-08-02 10:52   ` Oliver Neukum
2022-08-02 13:31     ` Andrew Lunn
2022-08-04  9:24       ` Oliver Neukum
2022-08-04 13:24         ` Andrew Lunn
2022-08-04 13:29           ` Oliver Neukum
2022-08-04 14:31             ` Andrew Lunn
2022-08-03  3:48 ` Hayes Wang [this message]
2022-08-04  8:57   ` Oliver Neukum
2022-08-08  7:04     ` Hayes Wang
2022-08-23  7:53       ` Oliver Neukum

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=0f5422bbeb7642f492b99e9ec1f07751@realtek.com \
    --to=hayeswang@realtek.com \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.