Skip to content

Commit 11d1426

Browse files
Subbaraman Narayanamurthygregkh
authored andcommitted
nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer
commit e2057ee upstream. "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. Fixes: 40ce979 ("nvmem: add QTI SDAM driver") Cc: stable@vger.kernel.org Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210205100853.32372-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent da5b48a commit 11d1426

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/nvmem/qcom-spmi-sdam.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
3+
* Copyright (c) 2017, 2020-2021, The Linux Foundation. All rights reserved.
44
*/
55

66
#include <linux/device.h>
@@ -18,7 +18,6 @@
1818
#define SDAM_PBS_TRIG_CLR 0xE6
1919

2020
struct sdam_chip {
21-
struct platform_device *pdev;
2221
struct regmap *regmap;
2322
struct nvmem_config sdam_config;
2423
unsigned int base;
@@ -65,7 +64,7 @@ static int sdam_read(void *priv, unsigned int offset, void *val,
6564
size_t bytes)
6665
{
6766
struct sdam_chip *sdam = priv;
68-
struct device *dev = &sdam->pdev->dev;
67+
struct device *dev = sdam->sdam_config.dev;
6968
int rc;
7069

7170
if (!sdam_is_valid(sdam, offset, bytes)) {
@@ -86,7 +85,7 @@ static int sdam_write(void *priv, unsigned int offset, void *val,
8685
size_t bytes)
8786
{
8887
struct sdam_chip *sdam = priv;
89-
struct device *dev = &sdam->pdev->dev;
88+
struct device *dev = sdam->sdam_config.dev;
9089
int rc;
9190

9291
if (!sdam_is_valid(sdam, offset, bytes)) {

0 commit comments

Comments
 (0)