mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
NFC: Fix NULL pointer dereference issue
Modify code and add proper NULL check to avoid NULL pointer dereference. Change-Id: I09c6a74b653b12e60c48fc5f63cca9148e117ee9 Signed-off-by: Tapas Dey <tdey@codeaurora.org>
This commit is contained in:
parent
9f842b7a49
commit
30e5a66dad
1 changed files with 17 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "nfc_common.h"
|
||||
|
|
@ -452,7 +452,14 @@ int nfc_i2c_dev_suspend(struct device *device)
|
|||
{
|
||||
struct i2c_client *client = to_i2c_client(device);
|
||||
struct nfc_dev *nfc_dev = i2c_get_clientdata(client);
|
||||
struct i2c_dev *i2c_dev = &nfc_dev->i2c_dev;
|
||||
struct i2c_dev *i2c_dev = NULL;
|
||||
|
||||
if (!nfc_dev) {
|
||||
pr_err("%s: device doesn't exist anymore\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
i2c_dev = &nfc_dev->i2c_dev;
|
||||
|
||||
NFCLOG_IPC(nfc_dev, false, "%s: irq_enabled = %d", __func__,
|
||||
i2c_dev->irq_enabled);
|
||||
|
|
@ -468,7 +475,14 @@ int nfc_i2c_dev_resume(struct device *device)
|
|||
{
|
||||
struct i2c_client *client = to_i2c_client(device);
|
||||
struct nfc_dev *nfc_dev = i2c_get_clientdata(client);
|
||||
struct i2c_dev *i2c_dev = &nfc_dev->i2c_dev;
|
||||
struct i2c_dev *i2c_dev = NULL;
|
||||
|
||||
if (!nfc_dev) {
|
||||
pr_err("%s: device doesn't exist anymore\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
i2c_dev = &nfc_dev->i2c_dev;
|
||||
|
||||
NFCLOG_IPC(nfc_dev, false, "%s: irq_wake_up = %d", __func__,
|
||||
i2c_dev->irq_wake_up);
|
||||
|
|
|
|||
Loading…
Reference in a new issue