[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f5422bbeb7642f492b99e9ec1f07751@realtek.com>
Date: Wed, 3 Aug 2022 03:48:55 +0000
From: Hayes Wang <hayeswang@...ltek.com>
To: Oliver Neukum <oneukum@...e.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [RFC] r8152: pass through needs to be singular
Oliver Neukum <oneukum@...e.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;
> }
Powered by blists - more mailing lists