mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com,
	andriy.shevchenko@linux.intel.com
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com,
	Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH for-next v1 2/3] pinctrl: baytrail: add warning for BYT_VAL_REG retrieval failure
Date: Sat, 17 Jun 2023 02:03:55 +0530	[thread overview]
Message-ID: <20230616203356.27343-3-raag.jadav@intel.com> (raw)
In-Reply-To: <20230616203356.27343-1-raag.jadav@intel.com>

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>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 8 ++++++++
 1 file changed, 8 insertions(+)

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) {
-- 
2.17.1


  parent reply	other threads:[~2023-06-16 20:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16 20:33 [PATCH for-next v1 0/3] Minor improvements for Baytrail pinctrl Raag Jadav
2023-06-16 20:33 ` [PATCH for-next v1 1/3] pinctrl: baytrail: reduce scope of spinlock in ->dbg_show() hook Raag Jadav
2023-06-16 20:33 ` Raag Jadav [this message]
2023-06-16 20:33 ` [PATCH for-next v1 3/3] pinctrl: baytrail: invert if condition Raag Jadav
2023-06-19  6:22 ` [PATCH for-next v1 0/3] Minor improvements for Baytrail pinctrl Mika Westerberg
2023-06-19 10:53   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230616203356.27343-3-raag.jadav@intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mallikarjunappa.sangannavar@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pandith.n@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®