asoc: codecs: Add proper NULL checks and initialize variables
Add null checks and initialize unintialized variables in wsa macro, wcd937x and wcd937x_slave drivers. CRs-Fixed: 2328286 Change-Id: I76b8d262e42d2b06ece3a6ecba28ed26b13d4447 Signed-off-by: Tanya Dixit <tdixit@codeaurora.org>
这个提交包含在:
@@ -31,6 +31,11 @@ static int wcd937x_slave_bind(struct device *dev,
|
||||
uint8_t devnum = 0;
|
||||
struct swr_device *pdev = to_swr_device(dev);
|
||||
|
||||
if (pdev == NULL) {
|
||||
dev_err(dev, "%s: pdev is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
wcd937x_slave = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct wcd937x_slave_priv), GFP_KERNEL);
|
||||
if (!wcd937x_slave)
|
||||
@@ -59,6 +64,11 @@ static void wcd937x_slave_unbind(struct device *dev,
|
||||
struct wcd937x_slave_priv *wcd937x_slave = NULL;
|
||||
struct swr_device *pdev = to_swr_device(dev);
|
||||
|
||||
if (pdev == NULL) {
|
||||
dev_err(dev, "%s: pdev is NULL\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
wcd937x_slave = swr_get_dev_data(pdev);
|
||||
if (!wcd937x_slave) {
|
||||
dev_err(&pdev->dev, "%s: wcd937x_slave is NULL\n", __func__);
|
||||
|
在新工单中引用
屏蔽一个用户