* [RESEND PATCH] nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer
@ 2021-02-03 18:15 Subbaraman Narayanamurthy
2021-02-04 14:25 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: Subbaraman Narayanamurthy @ 2021-02-03 18:15 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Srinivas Kandagatla
Cc: linux-arm-msm, linux-kernel, Subbaraman Narayanamurthy, stable
"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.
Cc: stable@vger.kernel.org
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
---
drivers/nvmem/qcom-spmi-sdam.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/nvmem/qcom-spmi-sdam.c b/drivers/nvmem/qcom-spmi-sdam.c
index a72704c..f6e9f96 100644
--- a/drivers/nvmem/qcom-spmi-sdam.c
+++ b/drivers/nvmem/qcom-spmi-sdam.c
@@ -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)) {
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer
2021-02-03 18:15 [RESEND PATCH] nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer Subbaraman Narayanamurthy
@ 2021-02-04 14:25 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2021-02-04 14:25 UTC (permalink / raw)
To: Subbaraman Narayanamurthy, Andy Gross, Bjorn Andersson
Cc: linux-arm-msm, linux-kernel, stable
On 03/02/2021 18:15, Subbaraman Narayanamurthy 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.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
> ---
Applied thanks,
--srini
> drivers/nvmem/qcom-spmi-sdam.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvmem/qcom-spmi-sdam.c b/drivers/nvmem/qcom-spmi-sdam.c
> index a72704c..f6e9f96 100644
> --- a/drivers/nvmem/qcom-spmi-sdam.c
> +++ b/drivers/nvmem/qcom-spmi-sdam.c
> @@ -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)) {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-04 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 18:15 [RESEND PATCH] nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer Subbaraman Narayanamurthy
2021-02-04 14:25 ` Srinivas Kandagatla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).