mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-13 22:26:41 +07:00
Some GPIO fixes for the v4.4 series:
- Fix a bunch of possible NULL references found by Coccinelle jockeys. - Stop creating Tegra's debugfs on everything and it's dog. This is an ARM multiplatform kernel issue. - Fix an oops in gpiolib for NULL names on named GPIOs. - Fix a complex OMAP1 bug in the OMAP driver. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWXvnbAAoJEEEQszewGV1z4yAQAMu8FON3frlLkXdgAs3CSl1v sBbtcI9T0Mda9cp78rUAo2diP5EnI13wRiQDCsf/9LI85//cE4fVXDIES6AEgrvf CV6VAI5XONKhN2o0DDRqCiIYNLG22GDH1B4Z0w77q0pr/aUavGJex9Jb9Cp36yUR qERPgEdtbTqdI3RnzatBTwNB4j23NMb5sa7A8X3H6Fe+e3ieEuQiYmBdQqhoF8zV f3l/EaU8TDS7Zm2CGGlB79jHmHqTpJ4/3qmMbaR0pQfO1MftRRS4xuS8ca73Qjt8 tc2uL20Z724H+2nGc2UZfmDkAL50KyWKRHPGYMVkJAlxEqeWqy4+9OQZC17YnedA JemVFfdpLBhObCXHhrwwL9uif0ViPW+IB/RfCJ0h8ta0w5VsxHAeOD4l1v28vALX kp4bAQExXU2pLDPlerCvXHDurJpESJDihFloII75brww+3xsaLiodhNLGiDlfctS OD1Eskm+3Lk8w7pDrEdsMK209F8T4Vfvu6/8qoyQmFf4fHgWm4y7+vPn5fNWRB9H qZPmveCqi8EF75lIQF5/+OliqMlFMKFGe+HrBNP9kmn3LBuI0u2+vjIHuOU8pr6m quwKgjzaWWwltyXwptl2CZFPz45cvAKiykVWKjIWuvC3leeoGdgV/OPJ8uZca42b F+8dRp/ppHkhN84pZl3d =aggl -----END PGP SIGNATURE----- Merge tag 'gpio-v4.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO fixes from Linus Walleij: "Some GPIO fixes for the v4.4 series: - Fix a bunch of possible NULL references found by Coccinelle jockeys. - Stop creating Tegra's debugfs on everything and its dog. This is an ARM multiplatform kernel issue. - Fix an oops in gpiolib for NULL names on named GPIOs. - Fix a complex OMAP1 bug in the OMAP driver" * tag 'gpio-v4.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: omap: drop omap1 mpuio specific irq_mask/unmask callbacks gpiolib: fix oops, if gpio name is NULL gpio-tegra: Do not create the debugfs entry by default gpio: palmas: fix a possible NULL dereference gpio: syscon: fix a possible NULL dereference gpio: 74xx: fix a possible NULL dereference
This commit is contained in:
commit
79e63f50c2
@ -113,13 +113,16 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
|
||||
|
||||
static int mmio_74xx_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct of_device_id *of_id =
|
||||
of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
|
||||
const struct of_device_id *of_id;
|
||||
struct mmio_74xx_gpio_priv *priv;
|
||||
struct resource *res;
|
||||
void __iomem *dat;
|
||||
int err;
|
||||
|
||||
of_id = of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
|
||||
if (!of_id)
|
||||
return -ENODEV;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
@ -1122,8 +1122,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
|
||||
/* MPUIO is a bit different, reading IRQ status clears it */
|
||||
if (bank->is_mpuio) {
|
||||
irqc->irq_ack = dummy_irq_chip.irq_ack;
|
||||
irqc->irq_mask = irq_gc_mask_set_bit;
|
||||
irqc->irq_unmask = irq_gc_mask_clr_bit;
|
||||
if (!bank->regs->wkup_en)
|
||||
irqc->irq_set_wake = NULL;
|
||||
}
|
||||
|
@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev)
|
||||
const struct palmas_device_data *dev_data;
|
||||
|
||||
match = of_match_device(of_palmas_gpio_match, &pdev->dev);
|
||||
if (!match)
|
||||
return -ENODEV;
|
||||
dev_data = match->data;
|
||||
if (!dev_data)
|
||||
dev_data = &palmas_dev_data;
|
||||
|
@ -187,11 +187,15 @@ MODULE_DEVICE_TABLE(of, syscon_gpio_ids);
|
||||
static int syscon_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct of_device_id *of_id = of_match_device(syscon_gpio_ids, dev);
|
||||
const struct of_device_id *of_id;
|
||||
struct syscon_gpio_priv *priv;
|
||||
struct device_node *np = dev->of_node;
|
||||
int ret;
|
||||
|
||||
of_id = of_match_device(syscon_gpio_ids, dev);
|
||||
if (!of_id)
|
||||
return -ENODEV;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
@ -375,6 +375,60 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
static int dbg_gpio_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < tegra_gpio_bank_count; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
int gpio = tegra_gpio_compose(i, j, 0);
|
||||
seq_printf(s,
|
||||
"%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
|
||||
i, j,
|
||||
tegra_gpio_readl(GPIO_CNF(gpio)),
|
||||
tegra_gpio_readl(GPIO_OE(gpio)),
|
||||
tegra_gpio_readl(GPIO_OUT(gpio)),
|
||||
tegra_gpio_readl(GPIO_IN(gpio)),
|
||||
tegra_gpio_readl(GPIO_INT_STA(gpio)),
|
||||
tegra_gpio_readl(GPIO_INT_ENB(gpio)),
|
||||
tegra_gpio_readl(GPIO_INT_LVL(gpio)));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dbg_gpio_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, dbg_gpio_show, &inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations debug_fops = {
|
||||
.open = dbg_gpio_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static void tegra_gpio_debuginit(void)
|
||||
{
|
||||
(void) debugfs_create_file("tegra_gpio", S_IRUGO,
|
||||
NULL, NULL, &debug_fops);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void tegra_gpio_debuginit(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static struct irq_chip tegra_gpio_irq_chip = {
|
||||
.name = "GPIO",
|
||||
.irq_ack = tegra_gpio_irq_ack,
|
||||
@ -519,6 +573,8 @@ static int tegra_gpio_probe(struct platform_device *pdev)
|
||||
spin_lock_init(&bank->lvl_lock[j]);
|
||||
}
|
||||
|
||||
tegra_gpio_debuginit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -536,52 +592,3 @@ static int __init tegra_gpio_init(void)
|
||||
return platform_driver_register(&tegra_gpio_driver);
|
||||
}
|
||||
postcore_initcall(tegra_gpio_init);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
static int dbg_gpio_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < tegra_gpio_bank_count; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
int gpio = tegra_gpio_compose(i, j, 0);
|
||||
seq_printf(s,
|
||||
"%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
|
||||
i, j,
|
||||
tegra_gpio_readl(GPIO_CNF(gpio)),
|
||||
tegra_gpio_readl(GPIO_OE(gpio)),
|
||||
tegra_gpio_readl(GPIO_OUT(gpio)),
|
||||
tegra_gpio_readl(GPIO_IN(gpio)),
|
||||
tegra_gpio_readl(GPIO_INT_STA(gpio)),
|
||||
tegra_gpio_readl(GPIO_INT_ENB(gpio)),
|
||||
tegra_gpio_readl(GPIO_INT_LVL(gpio)));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dbg_gpio_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, dbg_gpio_show, &inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations debug_fops = {
|
||||
.open = dbg_gpio_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int __init tegra_gpio_debuginit(void)
|
||||
{
|
||||
(void) debugfs_create_file("tegra_gpio", S_IRUGO,
|
||||
NULL, NULL, &debug_fops);
|
||||
return 0;
|
||||
}
|
||||
late_initcall(tegra_gpio_debuginit);
|
||||
#endif
|
||||
|
@ -233,7 +233,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
|
||||
for (i = 0; i != chip->ngpio; ++i) {
|
||||
struct gpio_desc *gpio = &chip->desc[i];
|
||||
|
||||
if (!gpio->name)
|
||||
if (!gpio->name || !name)
|
||||
continue;
|
||||
|
||||
if (!strcmp(gpio->name, name)) {
|
||||
|
Loading…
Reference in New Issue
Block a user