Skip to contentSkip to conversation

nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer

PATCH RESEND Applied Subbaraman Narayanamurthy 3 participants 3 messages Feb 3, 2021 – Mar 1, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer

"sdam->pdev" is uninitialized and it is used to print error logs. Fix it. Since device pointer can be used from sdam_config, use it directly thereby removing pdev pointer.

---
 drivers/nvmem/qcom-spmi-sdam.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/nvmem/qcom-spmi-sdam.c +3 -4
index a72704c..f6e9f96 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2020-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/device.h>
@@ -18,7 +18,6 @@
 #define SDAM_PBS_TRIG_CLR		0xE6
 
 struct sdam_chip {
-	struct platform_device		*pdev;
 	struct regmap			*regmap;
 	struct nvmem_config		sdam_config;
 	unsigned int			base;
@@ -65,7 +64,7 @@ static int sdam_read(void *priv, unsigned int offset, void *val,
 				size_t bytes)
 {
 	struct sdam_chip *sdam = priv;
-	struct device *dev = &sdam->pdev->dev;
+	struct device *dev = sdam->sdam_config.dev;
 	int rc;
 
 	if (!sdam_is_valid(sdam, offset, bytes)) {
@@ -86,7 +85,7 @@ static int sdam_write(void *priv, unsigned int offset, void *val,
 				size_t bytes)
 {
 	struct sdam_chip *sdam = priv;
-	struct device *dev = &sdam->pdev->dev;
+	struct device *dev = sdam->sdam_config.dev;
 	int rc;
 
 	if (!sdam_is_valid(sdam, offset, bytes)) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
Quoted 7 lines · Subbaraman Narayanamurthy

"sdam->pdev" is uninitialized and it is used to print error logs. Fix it. Since device pointer can be used from sdam_config, use it directly thereby removing pdev pointer.

---

Applied thanks,

--srini

Quoted 42 lines
  drivers/nvmem/qcom-spmi-sdam.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/nvmem/qcom-spmi-sdam.c +3 -4
index a72704c..f6e9f96 100644
@@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0-only
  /*
- * Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2020-2021, The Linux Foundation. All rights reserved.
   */
 
  #include <linux/device.h>
@@ -18,7 +18,6 @@
  #define SDAM_PBS_TRIG_CLR		0xE6
 
  struct sdam_chip {
-	struct platform_device		*pdev;
  	struct regmap			*regmap;
  	struct nvmem_config		sdam_config;
  	unsigned int			base;
@@ -65,7 +64,7 @@ static int sdam_read(void *priv, unsigned int offset, void *val,
  				size_t bytes)
  {
  	struct sdam_chip *sdam = priv;
-	struct device *dev = &sdam->pdev->dev;
+	struct device *dev = sdam->sdam_config.dev;
  	int rc;
 
  	if (!sdam_is_valid(sdam, offset, bytes)) {
@@ -86,7 +85,7 @@ static int sdam_write(void *priv, unsigned int offset, void *val,
  				size_t bytes)
  {
  	struct sdam_chip *sdam = priv;
-	struct device *dev = &sdam->pdev->dev;
+	struct device *dev = sdam->sdam_config.dev;
  	int rc;
 
  	if (!sdam_is_valid(sdam, offset, bytes)) {
#2 lore raw
In reply to Subbaraman Narayanamurthy
This patch was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

Quoted 8 lines · On Wed, 3 Feb 2021 10:15:26 -0800 you wrote:

"sdam->pdev" is uninitialized and it is used to print error logs. Fix it. Since device pointer can be used from sdam_config, use it directly thereby removing pdev pointer.

[...]

Here is the summary with links:
- [RESEND] nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer

    https://git.kernel.org/qcom/c/e2057ee29973

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html