Re: [PATCH v3 2/8] pinctrl: Add driver for the T-Head TH1520 SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 30-09-2024 om 21:50 schreef Drew Fustini:
From: Emil Renner Berthing <emil.renner.berthing@xxxxxxxxxxxxx>

Add pinctrl driver for the T-Head TH1520 RISC-V SoC.

Tested-by: Thomas Bonnefille <thomas.bonnefille@xxxxxxxxxxx>
Signed-off-by: Emil Renner Berthing <emil.renner.berthing@xxxxxxxxxxxxx>
[dfustini: use thead,pad-group to identify the pin controller instance]
Signed-off-by: Drew Fustini <dfustini@xxxxxxxxxxxxxxx>
---
  MAINTAINERS                      |   1 +
  drivers/pinctrl/Kconfig          |  13 +
  drivers/pinctrl/Makefile         |   1 +
  drivers/pinctrl/pinctrl-th1520.c | 907 +++++++++++++++++++++++++++++++++++++++
  4 files changed, 922 insertions(+)

[...]
+static int th1520_pinmux_set_mux(struct pinctrl_dev *pctldev,
+				 unsigned int fsel, unsigned int gsel)
+{
+	struct th1520_pinctrl *thp = pinctrl_dev_get_drvdata(pctldev);
+	const struct function_desc *func = pinmux_generic_get_function(pctldev, fsel);
func can be NULL after calling pinmux_generic_get_function
Please add something to avoid NULL pointer dereferencing in the next statement.
All other callers of pinmux_generic_get_function have something like this:
    if (!func)
        return -EINVAL;
+
+	return th1520_pinmux_set(thp, thp->desc.pins[gsel].number,
+				 (uintptr_t)thp->desc.pins[gsel].drv_data & TH1520_PAD_MUXDATA,
+				 (uintptr_t)func->data);
+}
+




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux