diff options
author | Raag Jadav <raag.jadav@intel.com> | 2023-06-16 22:33:55 +0200 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-06-19 12:53:26 +0200 |
commit | 9d49882e439efde737dbd65d6319123dbf91d42d (patch) | |
tree | a4d2d4987474337df86ff4afe055589bd91f2851 | |
parent | pinctrl: baytrail: reduce scope of spinlock in ->dbg_show() hook (diff) | |
download | linux-9d49882e439efde737dbd65d6319123dbf91d42d.tar.xz linux-9d49882e439efde737dbd65d6319123dbf91d42d.zip |
pinctrl: baytrail: add warning for BYT_VAL_REG retrieval failure
Add warning for BYT_VAL_REG retrieval failure and continue such case
to avoid unintended reads/writes in pm_ops.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20230616203356.27343-3-raag.jadav@intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r-- | drivers/pinctrl/intel/pinctrl-baytrail.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 54d3c5c26944..97ead2c58b66 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1758,6 +1758,10 @@ static int byt_gpio_suspend(struct device *dev) vg->context.pads[i].conf0 = value; reg = byt_gpio_reg(vg, pin, BYT_VAL_REG); + if (!reg) { + dev_warn(vg->dev, "Pin %i: can't retrieve VAL\n", i); + continue; + } value = readl(reg) & BYT_VAL_RESTORE_MASK; vg->context.pads[i].val = value; } @@ -1794,6 +1798,10 @@ static int byt_gpio_resume(struct device *dev) } reg = byt_gpio_reg(vg, pin, BYT_VAL_REG); + if (!reg) { + dev_warn(vg->dev, "Pin %i: can't retrieve VAL\n", i); + continue; + } value = readl(reg); if ((value & BYT_VAL_RESTORE_MASK) != vg->context.pads[i].val) { |