openwrt/target/linux/bcm27xx/patches-5.10/950-0549-r8152-check-if-the-pointer-of-the-function-exists.patch
Hauke Mehrtens 35985454a6 kernel: bump 5.10 to 5.10.196
Removed because already in upstream:
  target/linux/bcm53xx/patches-5.10/030-v5.11-0002-ARM-dts-BCM5301X-Harmonize-EHCI-OHCI-DT-nodes-name.patch
  target/linux/bcm53xx/patches-5.10/033-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch
  target/linux/bcm53xx/patches-5.10/040-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch
  target/linux/bcm53xx/patches-5.10/040-v6.6-0006-ARM-dts-BCM53573-Add-cells-sizes-to-PCIe-node.patch
  target/linux/bcm53xx/patches-5.10/040-v6.6-0007-ARM-dts-BCM53573-Use-updated-spi-gpio-binding-proper.patch
  target/linux/bcm53xx/patches-5.10/040-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch

All other patches automatically rebased.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-09-24 19:01:52 +02:00

52 lines
1.3 KiB
Diff

From e78b75f5be204a0a235da995d01c778dc282bb42 Mon Sep 17 00:00:00 2001
From: Hayes Wang <hayeswang@realtek.com>
Date: Fri, 19 Feb 2021 17:04:41 +0800
Subject: [PATCH] r8152: check if the pointer of the function exists
commit c79515e47935c747282c6ed2ee5b2ef039756eeb upstream.
Return error code if autosuspend_en, eee_get, or eee_set don't exist.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/usb/r8152.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -5763,6 +5763,9 @@ static int rtl8152_runtime_suspend(struc
struct net_device *netdev = tp->netdev;
int ret = 0;
+ if (!tp->rtl_ops.autosuspend_en)
+ return -EBUSY;
+
set_bit(SELECTIVE_SUSPEND, &tp->flags);
smp_mb__after_atomic();
@@ -6162,6 +6165,11 @@ rtl_ethtool_get_eee(struct net_device *n
struct r8152 *tp = netdev_priv(net);
int ret;
+ if (!tp->rtl_ops.eee_get) {
+ ret = -EOPNOTSUPP;
+ goto out;
+ }
+
ret = usb_autopm_get_interface(tp->intf);
if (ret < 0)
goto out;
@@ -6184,6 +6192,11 @@ rtl_ethtool_set_eee(struct net_device *n
struct r8152 *tp = netdev_priv(net);
int ret;
+ if (!tp->rtl_ops.eee_set) {
+ ret = -EOPNOTSUPP;
+ goto out;
+ }
+
ret = usb_autopm_get_interface(tp->intf);
if (ret < 0)
goto out;