Skip to content

Commit

Permalink
nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer
Browse files Browse the repository at this point in the history
"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: [email protected]
Signed-off-by: Subbaraman Narayanamurthy <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Subbaraman Narayanamurthy authored and gregkh committed Feb 5, 2021
1 parent b31f1eb commit e2057ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/nvmem/qcom-spmi-sdam.c
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand Down

0 comments on commit e2057ee

Please sign in to comment.