diff options
| author | Michael Bestas <mkbestas@lineageos.org> | 2020-07-23 02:33:49 +0300 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2020-07-23 02:33:49 +0300 |
| commit | d1cc3341f2d95b742bb075e309251fc2ae62a799 (patch) | |
| tree | 3f18735cd1a957309bf983d04bd76a01f3011258 /drivers | |
| parent | afe5d56d4f6580fccf499c4b552696ca4fea1768 (diff) | |
| parent | 684f18e29d4d2aba9b8155b3c2c1113ee5650b23 (diff) | |
Merge tag 'LA.UM.8.4.r1-05700-8x98.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.4 into lineage-17.1-caf-msm8998
* tag 'LA.UM.8.4.r1-05700-8x98.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.4:
msm: adsprpc: Fix array index underflow problem
profiler: Fix compilation errors
fbdev: msm: fix ret value while translating to mdp format
clk: msm: Fix compilation errors with clang
ath10k: Fix compilation issue
drm/msm/sde: Fix clang compilation in SDE driver
ais: cam_soc_api: Fix compilation error
msm: camera: reset atomic variable
msm: v4l2loopback: Fix clang compilation error
msm: Fix compilation error
asoc: msm-8998: Add new FE's for TDM Primary
diag: dci: Synchronize dci mempool buffers alloc and free
headers_lib: rename Android.bp
kbuild: skip install/check of headers right under uapi directories
uapi: export all arch specifics directories
kernel_headers: Fix headers not detected in incremental builds
kernel headers: Update comparison logic
Kbuild : Use no-export-headers to avoid exporting headers
kernel_headers: kernel headers library package
kbuild: replace genhdr-y with generated-y
uapi: export all headers under uapi directories
uapi: sound: move necessary sound headers under uapi
kernel: Fix build errors with LLVM
Revert "ARM: dts: msm: Remove cpu max frequency restriction on cold temp for msm8996."
ARM: dts: msm: Remove cpu max frequency restriction on cold temp for msm8996.
input: touchpanel: Fix compilation errors with clang
asoc: msm-8998: TDM device grouping changes for capture path
kbuild, x86: Track generated headers with generated-y
kbuild: Remove stale asm-generic wrappers
ARM: put types.h in uapi
msm: ais: jpegdma: Fix uninitialized variable
Makefile.headersinst: remove destination-y option
msm: adsprpc: DSP device node to provide restricted access to ADSP/SLPI
Conflicts:
.gitignore
drivers/mmc/core/sdio_cis.c
Change-Id: I70cf2a0fbcfcbc834a21cf7fa8db9bd2e1c755b1
Diffstat (limited to 'drivers')
37 files changed, 310 insertions, 145 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 23b48dc6981b..f2be7f119e8c 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -72,6 +72,16 @@ #define FASTRPC_CTX_MAGIC (0xbeeddeed) #define FASTRPC_CTX_MAX (256) #define FASTRPC_CTXID_MASK (0xFF0) +#define NUM_DEVICES 2 /* adsprpc-smd, adsprpc-smd-secure */ +#define MINOR_NUM_DEV 0 +#define MINOR_NUM_SECURE_DEV 1 +#define NON_SECURE_CHANNEL 0 +#define SECURE_CHANNEL 1 + +#define ADSP_DOMAIN_ID (0) +#define MDSP_DOMAIN_ID (1) +#define SDSP_DOMAIN_ID (2) +#define CDSP_DOMAIN_ID (3) #define IS_CACHE_ALIGNED(x) (((x) & ((L1_CACHE_BYTES)-1)) == 0) @@ -245,6 +255,8 @@ struct fastrpc_channel_ctx { int ramdumpenabled; void *remoteheap_ramdump_dev; struct fastrpc_glink_info link; + /* Indicates, if channel is restricted to secure node only */ + int secure; }; struct fastrpc_apps { @@ -321,6 +333,8 @@ struct fastrpc_file { struct dentry *debugfs_file; struct mutex map_mutex; char *debug_buf; + /* Identifies the device (MINOR_NUM_DEV / MINOR_NUM_SECURE_DEV) */ + int dev_minor; }; static struct fastrpc_apps gfa; @@ -577,12 +591,23 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map) { struct fastrpc_apps *me = &gfa; struct fastrpc_file *fl; - int vmid; + int vmid, cid = -1, err = 0; struct fastrpc_session_ctx *sess; if (!map) return; fl = map->fl; + if (fl && !(map->flags == ADSP_MMAP_HEAP_ADDR || + map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR)) { + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; + pr_err("adsprpc: ERROR:%s, Invalid channel id: %d, err:%d", + __func__, cid, err); + return; + } + } if (map->flags == ADSP_MMAP_HEAP_ADDR || map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) { spin_lock(&me->hlock); @@ -659,20 +684,21 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd, unsigned attr, struct fastrpc_apps *me = &gfa; struct fastrpc_session_ctx *sess; struct fastrpc_apps *apps = fl->apps; - int cid = fl->cid; struct fastrpc_channel_ctx *chan = NULL; struct fastrpc_mmap *map = NULL; struct dma_attrs attrs; dma_addr_t region_start = 0; void *region_vaddr = NULL; unsigned long flags; - int err = 0, vmid; + int err = 0, vmid, cid = -1; - VERIFY(err, cid >= 0 && cid < NUM_CHANNELS); - if (err) + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; goto bail; + } chan = &apps->channel[cid]; - if (!fastrpc_mmap_find(fl, fd, va, len, mflags, ppmap)) return 0; map = kzalloc(sizeof(*map), GFP_KERNEL); @@ -1577,12 +1603,22 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx, { struct smq_msg *msg = &ctx->msg; struct fastrpc_file *fl = ctx->fl; - struct fastrpc_channel_ctx *channel_ctx = &fl->apps->channel[fl->cid]; - int err = 0, len; + int err = 0, len, cid = -1; + struct fastrpc_channel_ctx *channel_ctx = NULL; + + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; + goto bail; + } + channel_ctx = &fl->apps->channel[fl->cid]; VERIFY(err, NULL != channel_ctx->chan); - if (err) + if (err) { + err = -ECHRNG; goto bail; + } msg->pid = current->tgid; msg->tid = current->pid; if (kernel) @@ -1683,7 +1719,11 @@ static void fastrpc_init(struct fastrpc_apps *me) init_completion(&me->channel[i].work); init_completion(&me->channel[i].workport); me->channel[i].sesscount = 0; + /* All channels are secure by default except CDSP */ + me->channel[i].secure = SECURE_CHANNEL; } + /* Set CDSP channel to non secure */ + me->channel[CDSP_DOMAIN_ID].secure = NON_SECURE_CHANNEL; } static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl); @@ -1694,11 +1734,21 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, { struct smq_invoke_ctx *ctx = NULL; struct fastrpc_ioctl_invoke *invoke = &inv->inv; - int cid = fl->cid; - int interrupted = 0; - int err = 0; + int err = 0, cid = -1, interrupted = 0; struct timespec invoket = {0}; + cid = fl->cid; + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; + goto bail; + } + VERIFY(err, fl->sctx != NULL); + if (err) { + err = -EBADR; + goto bail; + } + if (fl->profile) getnstimeofday(&invoket); @@ -1711,12 +1761,6 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, } } - VERIFY(err, fl->sctx != NULL); - if (err) - goto bail; - VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS); - if (err) - goto bail; if (!kernel) { VERIFY(err, 0 == context_restore_interrupted(fl, inv, &ctx)); @@ -2725,6 +2769,9 @@ static ssize_t fastrpc_debugfs_read(struct file *filp, char __user *buffer, len += scnprintf(fileinfo + len, DEBUGFS_SIZE - len, "|%-9d", chan->ssrcount); + len += scnprintf(fileinfo + len, + DEBUGFS_SIZE - len, "%s %d\n", + "secure:", chan->secure); for (j = 0; j < chan->sesscount; j++) { sess_used += chan->session[j].used; } @@ -2818,6 +2865,9 @@ static ssize_t fastrpc_debugfs_read(struct file *filp, char __user *buffer, "0x%-20lX|0x%-20llX|0x%-20zu\n\n", map->va, map->phys, map->size); + len += scnprintf(fileinfo + len, DEBUGFS_SIZE - len, + "%s %d\n\n", + "DEV_MINOR:", fl->dev_minor); } len += scnprintf(fileinfo + len, DEBUGFS_SIZE - len, "%-20s|%-20s|%-20s|%-20s\n", @@ -2894,7 +2944,7 @@ static const struct file_operations debugfs_fops = { static int fastrpc_channel_open(struct fastrpc_file *fl) { struct fastrpc_apps *me = &gfa; - int cid, err = 0; + int cid = -1, err = 0; mutex_lock(&me->smd_mutex); @@ -2902,9 +2952,11 @@ static int fastrpc_channel_open(struct fastrpc_file *fl) if (err) goto bail; cid = fl->cid; - VERIFY(err, cid >= 0 && cid < NUM_CHANNELS); - if (err) + VERIFY(err, cid >= ADSP_DOMAIN_ID && cid < NUM_CHANNELS); + if (err) { + err = -ECHRNG; goto bail; + } if (me->channel[cid].ssrcount != me->channel[cid].prevssrcount) { if (!me->channel[cid].issubsystemup) { @@ -2974,6 +3026,19 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) char strpid[PID_SIZE]; int buf_size = 0; + /* + * Indicates the device node opened + * MINOR_NUM_DEV or MINOR_NUM_SECURE_DEV + */ + int dev_minor = MINOR(inode->i_rdev); + + VERIFY(err, ((dev_minor == MINOR_NUM_DEV) || + (dev_minor == MINOR_NUM_SECURE_DEV))); + if (err) { + pr_err("adsprpc: Invalid dev minor num %d\n", dev_minor); + return err; + } + VERIFY(err, NULL != (fl = kzalloc(sizeof(*fl), GFP_KERNEL))); if (err) return err; @@ -3000,6 +3065,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) fl->mode = FASTRPC_MODE_SERIAL; fl->cid = -1; fl->init_mem = NULL; + fl->dev_minor = dev_minor; if (debugfs_file != NULL) fl->debugfs_file = debugfs_file; @@ -3025,6 +3091,23 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info) VERIFY(err, cid < NUM_CHANNELS); if (err) goto bail; + /* Check to see if the device node is non-secure */ + if (fl->dev_minor == MINOR_NUM_DEV) { + /* + * For non secure device node check and make sure that + * the channel allows non-secure access + * If not, bail. Session will not start. + * cid will remain -1 and client will not be able to + * invoke any other methods without failure + */ + if (fl->apps->channel[cid].secure == SECURE_CHANNEL) { + err = -EPERM; + pr_err("adsprpc: GetInfo failed dev %d, cid %d, secure %d\n", + fl->dev_minor, cid, + fl->apps->channel[cid].secure); + goto bail; + } + } fl->cid = cid; fl->ssrcount = fl->apps->channel[cid].ssrcount; VERIFY(err, !fastrpc_session_alloc_locked( @@ -3462,12 +3545,41 @@ bail: return err; } +static void configure_secure_channels(uint32_t secure_domains) +{ + struct fastrpc_apps *me = &gfa; + int ii = 0; + /* + * secure_domains contains the bitmask of the secure channels + * Bit 0 - ADSP + * Bit 1 - MDSP + * Bit 2 - SLPI + * Bit 3 - CDSP + */ + for (ii = ADSP_DOMAIN_ID; ii <= CDSP_DOMAIN_ID; ++ii) { + int secure = (secure_domains >> ii) & 0x01; + + me->channel[ii].secure = secure; + } +} + static int fastrpc_probe(struct platform_device *pdev) { int err = 0; struct fastrpc_apps *me = &gfa; struct device *dev = &pdev->dev; - + uint32_t secure_domains; + + if (of_get_property(dev->of_node, + "qcom,secure-domains", NULL) != NULL) { + VERIFY(err, !of_property_read_u32(dev->of_node, + "qcom,secure-domains", + &secure_domains)); + if (!err) + configure_secure_channels(secure_domains); + else + pr_info("adsprpc: unable to read the domain configuration from dts\n"); + } if (of_device_is_compatible(dev->of_node, "qcom,msm-fastrpc-compute-cb")) return fastrpc_cb_probe(dev); @@ -3543,6 +3655,7 @@ static int __init fastrpc_device_init(void) { struct fastrpc_apps *me = &gfa; struct device *dev = NULL; + struct device *secure_dev = NULL; int err = 0, i; debugfs_root = debugfs_create_dir("adsprpc", NULL); @@ -3559,7 +3672,7 @@ static int __init fastrpc_device_init(void) cdev_init(&me->cdev, &fops); me->cdev.owner = THIS_MODULE; VERIFY(err, 0 == cdev_add(&me->cdev, MKDEV(MAJOR(me->dev_no), 0), - 1)); + NUM_DEVICES)); if (err) goto cdev_init_bail; me->class = class_create(THIS_MODULE, "fastrpc"); @@ -3567,14 +3680,29 @@ static int __init fastrpc_device_init(void) if (err) goto class_create_bail; me->compat = (NULL == fops.compat_ioctl) ? 0 : 1; + /* + * Create devices and register with sysfs + * Create first device with minor number 0 + */ dev = device_create(me->class, NULL, - MKDEV(MAJOR(me->dev_no), 0), - NULL, gcinfo[0].name); + MKDEV(MAJOR(me->dev_no), MINOR_NUM_DEV), + NULL, DEVICE_NAME); VERIFY(err, !IS_ERR_OR_NULL(dev)); if (err) goto device_create_bail; + + /* Create secure device with minor number for secure device */ + secure_dev = device_create(me->class, NULL, + MKDEV(MAJOR(me->dev_no), MINOR_NUM_SECURE_DEV), + NULL, DEVICE_NAME_SECURE); + VERIFY(err, !IS_ERR_OR_NULL(secure_dev)); + if (err) + goto device_create_bail; + for (i = 0; i < NUM_CHANNELS; i++) { - me->channel[i].dev = dev; + me->channel[i].dev = secure_dev; + if (i == CDSP_DOMAIN_ID) + me->channel[i].dev = dev; me->channel[i].ssrcount = 0; me->channel[i].prevssrcount = 0; me->channel[i].issubsystemup = 1; @@ -3598,7 +3726,11 @@ device_create_bail: &me->channel[i].nb); } if (!IS_ERR_OR_NULL(dev)) - device_destroy(me->class, MKDEV(MAJOR(me->dev_no), 0)); + device_destroy(me->class, MKDEV(MAJOR(me->dev_no), + MINOR_NUM_DEV)); + if (!IS_ERR_OR_NULL(secure_dev)) + device_destroy(me->class, MKDEV(MAJOR(me->dev_no), + MINOR_NUM_SECURE_DEV)); class_destroy(me->class); class_create_bail: cdev_del(&me->cdev); @@ -3620,10 +3752,15 @@ static void __exit fastrpc_device_exit(void) for (i = 0; i < NUM_CHANNELS; i++) { if (!gcinfo[i].name) continue; - device_destroy(me->class, MKDEV(MAJOR(me->dev_no), i)); subsys_notif_unregister_notifier(me->channel[i].handle, &me->channel[i].nb); } + + /* Destroy the secure and non secure devices */ + device_destroy(me->class, MKDEV(MAJOR(me->dev_no), MINOR_NUM_DEV)); + device_destroy(me->class, MKDEV(MAJOR(me->dev_no), + MINOR_NUM_SECURE_DEV)); + class_destroy(me->class); cdev_del(&me->cdev); unregister_chrdev_region(me->dev_no, NUM_CHANNELS); diff --git a/drivers/char/adsprpc_shared.h b/drivers/char/adsprpc_shared.h index 4371bf6a2ae7..b79cc2230568 100644 --- a/drivers/char/adsprpc_shared.h +++ b/drivers/char/adsprpc_shared.h @@ -34,6 +34,7 @@ #define FASTRPC_GLINK_GUID "fastrpcglink-apps-dsp" #define FASTRPC_SMD_GUID "fastrpcsmd-apps-dsp" #define DEVICE_NAME "adsprpc-smd" +#define DEVICE_NAME_SECURE "adsprpc-smd-secure" /* Set for buffers that have no virtual mapping in userspace */ #define FASTRPC_ATTR_NOVA 0x1 diff --git a/drivers/char/diag/diag_dci.c b/drivers/char/diag/diag_dci.c index e9a6711c9990..cf2e08f65b64 100644 --- a/drivers/char/diag/diag_dci.c +++ b/drivers/char/diag/diag_dci.c @@ -1658,10 +1658,13 @@ unsigned char *dci_get_buffer_from_bridge(int token) { uint8_t retries = 0, max_retries = 3; unsigned char *buf = NULL; + unsigned long flags; do { + spin_lock_irqsave(&driver->dci_mempool_lock, flags); buf = diagmem_alloc(driver, DIAG_MDM_BUF_SIZE, dci_ops_tbl[token].mempool); + spin_unlock_irqrestore(&driver->dci_mempool_lock, flags); if (!buf) { usleep_range(5000, 5100); retries++; @@ -1679,12 +1682,15 @@ int diag_dci_write_bridge(int token, unsigned char *buf, int len) int diag_dci_write_done_bridge(int index, unsigned char *buf, int len) { + unsigned long flags; int token = BRIDGE_TO_TOKEN(index); if (!VALID_DCI_TOKEN(token)) { pr_err("diag: Invalid DCI token %d in %s\n", token, __func__); return -EINVAL; } + spin_lock_irqsave(&driver->dci_mempool_lock, flags); diagmem_free(driver, buf, dci_ops_tbl[token].mempool); + spin_unlock_irqrestore(&driver->dci_mempool_lock, flags); return 0; } #endif @@ -1698,6 +1704,7 @@ static int diag_send_dci_pkt_remote(unsigned char *data, int len, int tag, int dci_header_size = sizeof(struct diag_dci_header_t); int ret = DIAG_DCI_NO_ERROR; uint32_t write_len = 0; + unsigned long flags; if (!data) return -EIO; @@ -1731,7 +1738,9 @@ static int diag_send_dci_pkt_remote(unsigned char *data, int len, int tag, if (ret) { pr_err("diag: error writing dci pkt to remote proc, token: %d, err: %d\n", token, ret); + spin_lock_irqsave(&driver->dci_mempool_lock, flags); diagmem_free(driver, buf, dci_ops_tbl[token].mempool); + spin_unlock_irqrestore(&driver->dci_mempool_lock, flags); } else { ret = DIAG_DCI_NO_ERROR; } @@ -1755,6 +1764,7 @@ int diag_dci_send_handshake_pkt(int index) struct diag_ctrl_dci_handshake_pkt ctrl_pkt; unsigned char *buf = NULL; struct diag_dci_header_t dci_header; + unsigned long flags; if (!VALID_DCI_TOKEN(token)) { pr_err("diag: In %s, invalid DCI token %d\n", __func__, token); @@ -1794,7 +1804,9 @@ int diag_dci_send_handshake_pkt(int index) if (err) { pr_err("diag: error writing ack packet to remote proc, token: %d, err: %d\n", token, err); + spin_lock_irqsave(&driver->dci_mempool_lock, flags); diagmem_free(driver, buf, dci_ops_tbl[token].mempool); + spin_unlock_irqrestore(&driver->dci_mempool_lock, flags); return err; } @@ -2454,6 +2466,7 @@ int diag_send_dci_event_mask_remote(int token) int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; unsigned char *event_mask_ptr = NULL; uint32_t write_len = 0; + unsigned long flags; mutex_lock(&dci_event_mask_mutex); event_mask_ptr = dci_ops_tbl[token].event_mask_composite; @@ -2499,7 +2512,9 @@ int diag_send_dci_event_mask_remote(int token) if (err) { pr_err("diag: error writing event mask to remote proc, token: %d, err: %d\n", token, err); + spin_lock_irqsave(&driver->dci_mempool_lock, flags); diagmem_free(driver, buf, dci_ops_tbl[token].mempool); + spin_unlock_irqrestore(&driver->dci_mempool_lock, flags); ret = err; } else { ret = DIAG_DCI_NO_ERROR; @@ -2656,6 +2671,7 @@ int diag_send_dci_log_mask_remote(int token) int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int updated; uint32_t write_len = 0; + unsigned long flags; mutex_lock(&dci_log_mask_mutex); log_mask_ptr = dci_ops_tbl[token].log_mask_composite; @@ -2695,7 +2711,10 @@ int diag_send_dci_log_mask_remote(int token) if (err) { pr_err("diag: error writing log mask to remote processor, equip_id: %d, token: %d, err: %d\n", i, token, err); + spin_lock_irqsave(&driver->dci_mempool_lock, flags); diagmem_free(driver, buf, dci_ops_tbl[token].mempool); + spin_unlock_irqrestore(&driver->dci_mempool_lock, + flags); updated = 0; } if (updated) @@ -2840,6 +2859,7 @@ int diag_dci_init(void) mutex_init(&dci_log_mask_mutex); mutex_init(&dci_event_mask_mutex); spin_lock_init(&ws_lock); + spin_lock_init(&driver->dci_mempool_lock); ret = diag_dci_init_ops_tbl(); if (ret) diff --git a/drivers/char/diag/diagchar.h b/drivers/char/diag/diagchar.h index b49d8cb54349..bc7dd020e145 100644 --- a/drivers/char/diag/diagchar.h +++ b/drivers/char/diag/diagchar.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2008-2018,2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -549,6 +549,7 @@ struct diagchar_dev { struct workqueue_struct *diag_dci_wq; struct list_head cmd_reg_list; struct mutex cmd_reg_mutex; + spinlock_t dci_mempool_lock; uint32_t cmd_reg_count; struct mutex diagfwd_channel_mutex[NUM_PERIPHERALS]; /* Sizes that reflect memory pool sizes */ diff --git a/drivers/clk/msm/clock-gcc-8996.c b/drivers/clk/msm/clock-gcc-8996.c index 6dd2cf879c49..4dee851ae85f 100644 --- a/drivers/clk/msm/clock-gcc-8996.c +++ b/drivers/clk/msm/clock-gcc-8996.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -42,7 +42,7 @@ static void __iomem *virt_dbgbase; #define gpll0_out_main_source_val 1 #define gpll4_out_main_source_val 5 -#define FIXDIV(div) (div ? (2 * (div) - 1) : (0)) +#define FIXDIV(div) ((int)div ? (2 * (div) - 1) : (0)) #define F(f, s, div, m, n) \ { \ diff --git a/drivers/clk/msm/clock-gcc-8998.c b/drivers/clk/msm/clock-gcc-8998.c index b1c8cc43769f..c13c7c660ede 100644 --- a/drivers/clk/msm/clock-gcc-8998.c +++ b/drivers/clk/msm/clock-gcc-8998.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -44,7 +44,7 @@ static void __iomem *virt_dbgbase; #define gpll4_out_main_source_val 5 #define gpll0_early_div_source_val 6 -#define FIXDIV(div) (div ? (2 * (div) - 1) : (0)) +#define FIXDIV(div) ((int)div ? (2 * (div) - 1) : (0)) #define F(f, s, div, m, n) \ { \ diff --git a/drivers/clk/msm/clock-mmss-8996.c b/drivers/clk/msm/clock-mmss-8996.c index 339ae1622005..845cb001d091 100644 --- a/drivers/clk/msm/clock-mmss-8996.c +++ b/drivers/clk/msm/clock-mmss-8996.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2016, 2018, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -53,7 +53,7 @@ static void __iomem *virt_base_gpu; #define dsi1phypll_mm_source_val 2 #define ext_extpclk_clk_src_mm_source_val 1 -#define FIXDIV(div) (div ? (2 * (div) - 1) : (0)) +#define FIXDIV(div) ((int)div ? (2 * (div) - 1) : (0)) #define F_MM(f, s, div, m, n) \ { \ diff --git a/drivers/clk/msm/clock-mmss-8998.c b/drivers/clk/msm/clock-mmss-8998.c index fdaaa723accd..ebf1c78402ed 100644 --- a/drivers/clk/msm/clock-mmss-8998.c +++ b/drivers/clk/msm/clock-mmss-8998.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -51,7 +51,7 @@ static void __iomem *virt_base; #define ext_dp_phy_pll_link_mm_source_val 1 #define ext_dp_phy_pll_vco_mm_source_val 2 -#define FIXDIV(div) (div ? (2 * (div) - 1) : (0)) +#define FIXDIV(div) ((int)div ? (2 * (div) - 1) : (0)) #define F_MM(f, s, div, m, n) \ { \ diff --git a/drivers/clk/msm/clock-osm.c b/drivers/clk/msm/clock-osm.c index a1635bad3bb0..4aa298c80679 100644 --- a/drivers/clk/msm/clock-osm.c +++ b/drivers/clk/msm/clock-osm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -272,7 +272,7 @@ static void __iomem *debug_base; #define ACD_REG_RELATIVE_ADDR_BITMASK(addr) \ (1 << (ACD_REG_RELATIVE_ADDR(addr))) -#define FIXDIV(div) (div ? (2 * (div) - 1) : (0)) +#define FIXDIV(div) ((int)div ? (2 * (div) - 1) : (0)) #define F(f, s, div, m, n) \ { \ diff --git a/drivers/clk/qcom/clk-debug.c b/drivers/clk/qcom/clk-debug.c index 50d0d01188ed..496b80eace5b 100644 --- a/drivers/clk/qcom/clk-debug.c +++ b/drivers/clk/qcom/clk-debug.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, 2016-2017, + * Copyright (c) 2013-2014, 2016-2017, 2020, * * The Linux Foundation. All rights reserved. * @@ -177,13 +177,12 @@ static int clk_debug_mux_set_parent(struct clk_hw *hw, u8 index) regval |= (meas->parent[index].next_sel & meas->mask); - if (meas->parent[index].en_mask == 0xFF) - /* Skip en_mask */ - regval = regval; - else if (meas->parent[index].en_mask) - regval |= meas->parent[index].en_mask; - else - regval |= meas->en_mask; + if (meas->parent[index].en_mask != 0xFF) { + if (meas->parent[index].en_mask) + regval |= meas->parent[index].en_mask; + else + regval |= meas->en_mask; + } regmap_write(meas->regmap[dbg_cc], 0x0, regval); } diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c index 91c837ff13dc..ae66861c69d4 100644 --- a/drivers/gpu/drm/msm/sde/sde_plane.c +++ b/drivers/gpu/drm/msm/sde/sde_plane.c @@ -1871,7 +1871,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, } if (sde_is_custom_client()) { - if (catalog->mixer_count && catalog->mixer && + if (catalog->mixer_count && catalog->mixer[0].sblk->maxblendstages) { zpos_max = catalog->mixer[0].sblk->maxblendstages - 1; if (zpos_max > SDE_STAGE_MAX - SDE_STAGE_0 - 1) diff --git a/drivers/input/touchscreen/st/fts_gui.c b/drivers/input/touchscreen/st/fts_gui.c index f695137ada09..800237c6bff7 100644 --- a/drivers/input/touchscreen/st/fts_gui.c +++ b/drivers/input/touchscreen/st/fts_gui.c @@ -58,7 +58,7 @@ ssize_t fts_i2c_wr_show(struct device *dev, struct device_attribute *attr, snprintf(buff, sizeof(buff), "{"); strlcat(Out_buff, buff, ARRAY_SIZE(Out_buff)); for (i = 0; i < (byte_count_read+2); i++) { - if ((i == 0)) { + if (i == 0) { char temp_byte_count_read = (byte_count_read >> 8) & 0xFF; snprintf(buff, sizeof(buff), "%02X", temp_byte_count_read); } else if (i == 1) { @@ -125,7 +125,7 @@ ssize_t fts_i2c_wr_store(struct device *dev, struct device_attribute *attr, #ifdef SCRIPTLESS_DEBUG printk("%s:DATA READ\n{", __func__); for (i = 0; i < (2+byte_count_read); i++) { - if ((i == 0)) { + if (i == 0) { char temp_byte_count_read = (byte_count_read >> 8) & 0xFF; printk("%02X", (unsigned int)temp_byte_count_read); } else if (i == 1) { @@ -173,7 +173,7 @@ ssize_t fts_i2c_read_show(struct device *dev, struct device_attribute *attr, snprintf(buff, sizeof(buff), "{"); strlcat(Out_buff, buff, ARRAY_SIZE(Out_buff)); for (i = 0; i < (byte_count_read+2); i++) { - if ((i == 0)) { + if (i == 0) { char temp_byte_count_read = (byte_count_read >> 8) & 0xFF; snprintf(buff, sizeof(buff), "%02X", temp_byte_count_read); } else if (i == 1) { @@ -241,7 +241,7 @@ ssize_t fts_i2c_read_store(struct device *dev, struct device_attribute *attr, #ifdef SCRIPTLESS_DEBUG printk("%s:DATA READ\n{", __func__); for (i = 0; i < (byte_count_read+2); i++) { - if ((i == 0)) { + if (i == 0) { char temp_byte_count_read = (byte_count_read >> 8) & 0xFF; printk("%02X", (unsigned int)temp_byte_count_read); } else if (i == 1) { diff --git a/drivers/input/touchscreen/st/fts_lib/ftsGesture.c b/drivers/input/touchscreen/st/fts_lib/ftsGesture.c index ee97a417d4cb..89f84efc08e2 100644 --- a/drivers/input/touchscreen/st/fts_lib/ftsGesture.c +++ b/drivers/input/touchscreen/st/fts_lib/ftsGesture.c @@ -334,7 +334,9 @@ int addCustomGesture(u8 *data, int size, u8 gestureID) index = gestureID - GESTURE_CUSTOM_OFFSET; logError(0, "%s Starting Custom Gesture Adding procedure...\n", tag); - if (size != GESTURE_CUSTOM_POINTS && gestureID != GES_ID_CUST1 && gestureID != GES_ID_CUST2 && gestureID != GES_ID_CUST3 && gestureID != GES_ID_CUST4 && gestureID && GES_ID_CUST5) { + if ((size != GESTURE_CUSTOM_POINTS) && (gestureID != GES_ID_CUST1) + && (gestureID != GES_ID_CUST2) && (gestureID != GES_ID_CUST3) + && (gestureID != GES_ID_CUST4) && (gestureID != GES_ID_CUST5)) { logError(1, "%s addCustomGesture: Invalid size (%d) or Custom GestureID (%02X)! ERROR %08X\n", tag, size, gestureID, ERROR_OP_NOT_ALLOW); return ERROR_OP_NOT_ALLOW; } @@ -364,7 +366,9 @@ int removeCustomGesture(u8 gestureID) index = gestureID - GESTURE_CUSTOM_OFFSET; logError(0, "%s Starting Custom Gesture Removing procedure...\n", tag); - if (gestureID != GES_ID_CUST1 && gestureID != GES_ID_CUST2 && gestureID != GES_ID_CUST3 && gestureID != GES_ID_CUST4 && gestureID && GES_ID_CUST5) { + if ((gestureID != GES_ID_CUST1) && (gestureID != GES_ID_CUST2) + && (gestureID != GES_ID_CUST3) && (gestureID != GES_ID_CUST4) + && (gestureID != GES_ID_CUST5)) { logError(1, "%s removeCustomGesture: Invalid size (%d) or Custom GestureID (%02X)! ERROR %08X\n", tag, gestureID, ERROR_OP_NOT_ALLOW); return ERROR_OP_NOT_ALLOW; } @@ -381,7 +385,8 @@ int removeCustomGesture(u8 gestureID) return res; } - if (readData[2] != gestureID || readData[4] != 0x00) { /* check of gestureID is redundant */ + /* check of gestureID is redundant */ + if ((readData[2] != gestureID) || (readData[4] != 0x00)) { logError(1, "%s removeCustomGesture: remove event status not OK! ERROR %08X\n", tag, readData[4]); return ERROR_GESTURE_REMOVE; } diff --git a/drivers/media/platform/msm/ais/common/cam_soc_api.c b/drivers/media/platform/msm/ais/common/cam_soc_api.c index 6c0e188adb75..22d986304596 100644 --- a/drivers/media/platform/msm/ais/common/cam_soc_api.c +++ b/drivers/media/platform/msm/ais/common/cam_soc_api.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -210,7 +210,7 @@ int msm_camera_get_clk_info(struct platform_device *pdev, { int rc = 0; - if (!pdev || !&pdev->dev || !clk_info || !clk_ptr || !num_clk) + if (!pdev || !clk_info || !clk_ptr || !num_clk) return -EINVAL; rc = msm_camera_get_clk_info_internal(&pdev->dev, diff --git a/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_hw.c b/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_hw.c index 3202699aec85..6695e631a5d9 100644 --- a/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_hw.c +++ b/drivers/media/platform/msm/ais/jpeg_dma/msm_jpeg_dma_hw.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1664,7 +1664,7 @@ void msm_jpegdma_hw_put(struct msm_jpegdma_device *dma) */ static int msm_jpegdma_hw_attach_iommu(struct msm_jpegdma_device *dma) { - int ret; + int ret = -EINVAL; mutex_lock(&dma->lock); diff --git a/drivers/media/platform/msm/camera_v2/msm.c b/drivers/media/platform/msm/camera_v2/msm.c index e16d08681695..66897a7778a9 100644 --- a/drivers/media/platform/msm/camera_v2/msm.c +++ b/drivers/media/platform/msm/camera_v2/msm.c @@ -231,6 +231,8 @@ static inline void msm_pm_qos_add_request(void) static void msm_pm_qos_remove_request(void) { pr_info("%s: remove request", __func__); + if (!atomic_cmpxchg(&qos_add_request_done, 1, 0)) + return; pm_qos_remove_request(&msm_v4l2_pm_qos_request); } diff --git a/drivers/media/platform/msm/vidc/hfi_response_handler.c b/drivers/media/platform/msm/vidc/hfi_response_handler.c index d3a7e4ce06b7..259d86744ff7 100644 --- a/drivers/media/platform/msm/vidc/hfi_response_handler.c +++ b/drivers/media/platform/msm/vidc/hfi_response_handler.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016,2019 The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2016, 2019-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1844,7 +1844,7 @@ static int hfi_process_session_rel_buf_done(u32 device_id, cmd_done.size = sizeof(struct msm_vidc_cb_cmd_done); cmd_done.session_id = (void *)(uintptr_t)pkt->session_id; cmd_done.status = hfi_map_err_status(pkt->error_type); - if (pkt->rg_buffer_info) { + if (pkt->rg_buffer_info != NULL) { cmd_done.data.buffer_info.buffer_addr = *pkt->rg_buffer_info; cmd_done.size = sizeof(struct hal_buffer_info); } else { diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c index 81ce5813cec4..40781ace9d21 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_vidc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1542,16 +1542,17 @@ int msm_vidc_destroy(struct msm_vidc_inst *inst) return 0; } -int msm_vidc_close(void *instance) +static void close_helper(struct kref *kref) { - void close_helper(struct kref *kref) - { - struct msm_vidc_inst *inst = container_of(kref, - struct msm_vidc_inst, kref); + struct msm_vidc_inst *inst = container_of(kref, + struct msm_vidc_inst, kref); - msm_vidc_destroy(inst); - } + msm_vidc_destroy(inst); +} + +int msm_vidc_close(void *instance) +{ struct msm_vidc_inst *inst = instance; struct buffer_info *bi, *dummy; int rc = 0, i = 0; diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index bbf5e33a99f7..b56b48a6b7b0 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -712,16 +712,17 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data) return; } -static void put_inst(struct msm_vidc_inst *inst) +static void put_inst_helper(struct kref *kref) { - void put_inst_helper(struct kref *kref) - { - struct msm_vidc_inst *inst = container_of(kref, - struct msm_vidc_inst, kref); + struct msm_vidc_inst *inst = container_of(kref, + struct msm_vidc_inst, kref); - msm_vidc_destroy(inst); - } + msm_vidc_destroy(inst); +} + +static void put_inst(struct msm_vidc_inst *inst) +{ if (!inst) return; diff --git a/drivers/media/platform/msm/vidc/msm_vidc_res_parse.c b/drivers/media/platform/msm/vidc/msm_vidc_res_parse.c index 925914bc7a6d..6a2eb9121f6b 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_res_parse.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_res_parse.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -54,13 +54,13 @@ fail_read: return 0; } -static inline enum imem_type read_imem_type(struct platform_device *pdev) +static bool is_compatible(char *compat) { - bool is_compatible(char *compat) - { - return !!of_find_compatible_node(NULL, NULL, compat); - } + return !!of_find_compatible_node(NULL, NULL, compat); +} +static inline enum imem_type read_imem_type(struct platform_device *pdev) +{ return is_compatible("qcom,msm-ocmem") ? IMEM_OCMEM : is_compatible("qcom,msm-vmem") ? IMEM_VMEM : IMEM_NONE; @@ -518,20 +518,19 @@ error: return rc; } +static int cmp(const void *a, const void *b) +{ + /* want to sort in reverse so flip the comparison */ + return ((struct load_freq_table *)b)->load - + ((struct load_freq_table *)a)->load; +} + static int msm_vidc_load_freq_table(struct msm_vidc_platform_resources *res) { int rc = 0; int num_elements = 0; struct platform_device *pdev = res->pdev; - /* A comparator to compare loads (needed later on) */ - int cmp(const void *a, const void *b) - { - /* want to sort in reverse so flip the comparison */ - return ((struct load_freq_table *)b)->load - - ((struct load_freq_table *)a)->load; - } - if (!of_find_property(pdev->dev.of_node, "qcom,load-freq-tbl", NULL)) { /* qcom,load-freq-tbl is an optional property. It likely won't * be present on cores that we can't clock scale on. */ diff --git a/drivers/media/v4l2loopback-master/v4l2loopback.c b/drivers/media/v4l2loopback-master/v4l2loopback.c index b6e7f6a2a768..71d3f4b5a24c 100644 --- a/drivers/media/v4l2loopback-master/v4l2loopback.c +++ b/drivers/media/v4l2loopback-master/v4l2loopback.c @@ -2145,7 +2145,7 @@ static int free_buffers(struct v4l2_loopback_device *dev) static void try_free_buffers(struct v4l2_loopback_device *dev) { MARK(); - if (dev->open_count.counter && !dev->keep_format == 0) { + if ((dev->open_count.counter && !dev->keep_format) == 0) { free_buffers(dev); dev->ready_for_capture = 0; dev->buffer_size = 0; diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c index 8e06e1020ad9..849592f45889 100644 --- a/drivers/misc/lkdtm.c +++ b/drivers/misc/lkdtm.c @@ -381,6 +381,7 @@ static void execute_user_location(void *dst) static void lkdtm_do_action(enum ctype which) { + int *ptr = NULL; switch (which) { case CT_PANIC: panic("dumptest"); @@ -392,7 +393,7 @@ static void lkdtm_do_action(enum ctype which) WARN_ON(1); break; case CT_EXCEPTION: - *((int *) 0) = 0; + *ptr = 0; break; case CT_LOOP: for (;;) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index b68e3a5b9046..dc97105a9a5d 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -6048,7 +6048,7 @@ static struct sk_buff *ath10k_wmi_10_4_op_gen_init(struct ath10k *ar) int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg) { - if (arg->ie_len && !arg->ie) + if (arg->ie_len) return -EINVAL; if (arg->n_channels && !arg->channels) return -EINVAL; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_reg.c b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_reg.c index 9fe7b6c59302..4a7b7a72fd99 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_reg.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_reg.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1529,16 +1529,13 @@ void ipahal_get_disable_aggr_valmask(struct ipahal_reg_valmask *valmask) IPAHAL_ERR("Input error\n"); return; } + valmask->val = (1 << IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_SHFT) & + IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_BMSK; + valmask->mask = IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_BMSK; - valmask->val = (1 & IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_BMSK) << - IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_SHFT; - valmask->mask = IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_BMSK << - IPA_ENDP_INIT_AGGR_n_AGGR_FORCE_CLOSE_SHFT; - - valmask->val |= ((0 & IPA_ENDP_INIT_AGGR_n_AGGR_EN_BMSK) << - IPA_ENDP_INIT_AGGR_n_AGGR_EN_SHFT); - valmask->mask |= ((IPA_ENDP_INIT_AGGR_n_AGGR_EN_BMSK << - IPA_ENDP_INIT_AGGR_n_AGGR_EN_SHFT)); + valmask->val |= ((0 << IPA_ENDP_INIT_AGGR_n_AGGR_EN_SHFT) & + IPA_ENDP_INIT_AGGR_n_AGGR_EN_BMSK); + valmask->mask |= IPA_ENDP_INIT_AGGR_n_AGGR_EN_BMSK; } u32 ipahal_aggr_get_max_byte_limit(void) diff --git a/drivers/platform/msm/usb_bam.c b/drivers/platform/msm/usb_bam.c index a9bcabfdb009..b1d9211e09df 100644 --- a/drivers/platform/msm/usb_bam.c +++ b/drivers/platform/msm/usb_bam.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1400,7 +1400,7 @@ void usb_bam_finish_suspend_(struct work_struct *w) info_ptr = container_of(w, struct usb_bam_ipa_handshake_info, finish_suspend_work); - cur_bam = info_ptr->cur_bam_mode; + cur_bam = (enum usb_ctrl)(info_ptr->cur_bam_mode); log_event_dbg("%s: Finishing suspend sequence(BAM=%s)\n", __func__, bam_enable_strings[cur_bam]); diff --git a/drivers/power/supply/qcom/msm_bcl.c b/drivers/power/supply/qcom/msm_bcl.c index aea3f4645897..843cb415e810 100644 --- a/drivers/power/supply/qcom/msm_bcl.c +++ b/drivers/power/supply/qcom/msm_bcl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, 2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -227,8 +227,8 @@ int msm_bcl_enable(void) int ret = 0, i = 0; struct bcl_param_data *param_data = NULL; - if (!bcl[i] || !bcl[BCL_PARAM_VOLTAGE]->thresh - || !bcl[BCL_PARAM_CURRENT]->thresh) { + if (!bcl[i] || (bcl[BCL_PARAM_VOLTAGE]->thresh == NULL) + || (bcl[BCL_PARAM_CURRENT]->thresh == NULL)) { pr_err("BCL not initialized\n"); return -EINVAL; } diff --git a/drivers/regulator/qpnp-lcdb-regulator.c b/drivers/regulator/qpnp-lcdb-regulator.c index 28c7da33afe0..e295fe440a61 100644 --- a/drivers/regulator/qpnp-lcdb-regulator.c +++ b/drivers/regulator/qpnp-lcdb-regulator.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1671,8 +1671,8 @@ static int qpnp_lcdb_init_bst(struct qpnp_lcdb *lcdb) if (lcdb->bst.ps != -EINVAL) { rc = qpnp_lcdb_masked_write(lcdb, lcdb->base + - LCDB_PS_CTL_REG, EN_PS_BIT, - &lcdb->bst.ps ? EN_PS_BIT : 0); + LCDB_PS_CTL_REG, EN_PS_BIT, + lcdb->bst.ps ? EN_PS_BIT : 0); if (rc < 0) { pr_err("Failed to disable BST PS rc=%d", rc); return rc; diff --git a/drivers/soc/qcom/msm_bus/msm_bus_dbg.c b/drivers/soc/qcom/msm_bus/msm_bus_dbg.c index 444d79fa061f..b8963a00374c 100644 --- a/drivers/soc/qcom/msm_bus/msm_bus_dbg.c +++ b/drivers/soc/qcom/msm_bus/msm_bus_dbg.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2010-2012, 2014-2015, 2017 The Linux Foundation. All rights - * reserved. +/* Copyright (c) 2010-2012, 2014-2015, 2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and diff --git a/drivers/soc/qcom/msm_bus/msm_bus_rules.c b/drivers/soc/qcom/msm_bus/msm_bus_rules.c index cafddcd65561..bd032c900624 100644 --- a/drivers/soc/qcom/msm_bus/msm_bus_rules.c +++ b/drivers/soc/qcom/msm_bus/msm_bus_rules.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and diff --git a/drivers/soc/qcom/msm_performance.c b/drivers/soc/qcom/msm_performance.c index 1857d369bc94..8b78ac889eac 100644 --- a/drivers/soc/qcom/msm_performance.c +++ b/drivers/soc/qcom/msm_performance.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2018, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2728,9 +2728,9 @@ error: for (i = 0; i < num_clusters; i++) { if (!managed_clusters[i]) break; - if (managed_clusters[i]->offlined_cpus) + if (managed_clusters[i]->offlined_cpus != NULL) free_cpumask_var(managed_clusters[i]->offlined_cpus); - if (managed_clusters[i]->cpus) + if (managed_clusters[i]->cpus != NULL) free_cpumask_var(managed_clusters[i]->cpus); kfree(managed_clusters[i]); } diff --git a/drivers/soc/qcom/qdsp6v2/apr.c b/drivers/soc/qcom/qdsp6v2/apr.c index ba5be240dfea..3060308652d5 100644 --- a/drivers/soc/qcom/qdsp6v2/apr.c +++ b/drivers/soc/qcom/qdsp6v2/apr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2014, 2016, 2018-2019 The Linux Foundation. +/* Copyright (c) 2010-2014, 2016, 2018-2020 The Linux Foundation. * All rights reserved. * * This program is free software; you can redistribute it and/or modify diff --git a/drivers/soc/qcom/system_stats.c b/drivers/soc/qcom/system_stats.c index ba35928a991b..30e15a0a2c9a 100644 --- a/drivers/soc/qcom/system_stats.c +++ b/drivers/soc/qcom/system_stats.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -298,6 +298,7 @@ static int msm_rpmstats_probe(struct platform_device *pdev) void __iomem *offset_addr = NULL; struct resource res; int i, ret = 0; + size_t master_name_len = 0; if (!pdev) return -EINVAL; @@ -365,7 +366,7 @@ static int msm_rpmstats_probe(struct platform_device *pdev) * Read master names from DT */ for (i = 0; i < ss.num_masters; i++) { - const char *master_name; + const char *master_name = NULL; of_property_read_string_index(pdev->dev.of_node, "qcom,masters", @@ -377,8 +378,9 @@ static int msm_rpmstats_probe(struct platform_device *pdev) pr_err("%s:Failed to get memory\n", __func__); return -ENOMEM; } + master_name_len = strlen(master_name); strlcpy(ss.master[i], master_name, - strlen(master_name) + 1); + master_name_len + 1); } dent = debugfs_create_file("system_stats", S_IRUGO, NULL, diff --git a/drivers/thermal/msm-tsens.c b/drivers/thermal/msm-tsens.c index d65e0b62c6c5..558d09efab53 100644 --- a/drivers/thermal/msm-tsens.c +++ b/drivers/thermal/msm-tsens.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -995,7 +995,8 @@ static int tsens_tm_activate_trip_type(struct thermal_zone_device *thermal, switch (trip) { case TSENS_TM_TRIP_CRITICAL: tmdev->sensor[tm_sensor->sensor_hw_num]. - debug_thr_state_copy.crit_th_state = mode; + debug_thr_state_copy.crit_th_state = + (enum thermal_device_mode) mode; reg_cntl = readl_relaxed(TSENS_TM_CRITICAL_INT_MASK (tmdev->tsens_addr)); if (mode == THERMAL_TRIP_ACTIVATION_DISABLED) @@ -1009,7 +1010,8 @@ static int tsens_tm_activate_trip_type(struct thermal_zone_device *thermal, break; case TSENS_TM_TRIP_WARM: tmdev->sensor[tm_sensor->sensor_hw_num]. - debug_thr_state_copy.high_th_state = mode; + debug_thr_state_copy.high_th_state = + (enum thermal_device_mode) mode; reg_cntl = readl_relaxed(TSENS_TM_UPPER_LOWER_INT_MASK (tmdev->tsens_addr)); if (mode == THERMAL_TRIP_ACTIVATION_DISABLED) @@ -1025,7 +1027,8 @@ static int tsens_tm_activate_trip_type(struct thermal_zone_device *thermal, break; case TSENS_TM_TRIP_COOL: tmdev->sensor[tm_sensor->sensor_hw_num]. - debug_thr_state_copy.low_th_state = mode; + debug_thr_state_copy.low_th_state = + (enum thermal_device_mode) mode; reg_cntl = readl_relaxed(TSENS_TM_UPPER_LOWER_INT_MASK (tmdev->tsens_addr)); if (mode == THERMAL_TRIP_ACTIVATION_DISABLED) @@ -1071,7 +1074,8 @@ static int tsens_tz_activate_trip_type(struct thermal_zone_device *thermal, switch (trip) { case TSENS_TRIP_WARM: tmdev->sensor[tm_sensor->sensor_hw_num]. - debug_thr_state_copy.high_th_state = mode; + debug_thr_state_copy.high_th_state = + (enum thermal_device_mode)mode; code = (reg_cntl & TSENS_UPPER_THRESHOLD_MASK) >> TSENS_UPPER_THRESHOLD_SHIFT; @@ -1082,7 +1086,8 @@ static int tsens_tz_activate_trip_type(struct thermal_zone_device *thermal, break; case TSENS_TRIP_COOL: tmdev->sensor[tm_sensor->sensor_hw_num]. - debug_thr_state_copy.low_th_state = mode; + debug_thr_state_copy.low_th_state = + (enum thermal_device_mode)mode; code = (reg_cntl & TSENS_LOWER_THRESHOLD_MASK); mask = TSENS_LOWER_STATUS_CLR; diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c index 9f47a1986f85..cc2f00b2c3d0 100644 --- a/drivers/thermal/msm_thermal.c +++ b/drivers/thermal/msm_thermal.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2803,7 +2803,7 @@ static int do_vdd_mx(void) } } - if ((dis_cnt == thresh[MSM_VDD_MX_RESTRICTION].thresh_ct)) { + if (dis_cnt == thresh[MSM_VDD_MX_RESTRICTION].thresh_ct) { ret = remove_vdd_mx_restriction(); if (ret) pr_err("Failed to remove vdd mx restriction\n"); @@ -6293,7 +6293,7 @@ static int fetch_cpu_mitigaiton_info(struct msm_thermal_data *data, struct platform_device *pdev) { - int _cpu = 0, err = 0; + int _cpu = 0, err = 0, sensor_name_len = 0; struct device_node *cpu_node = NULL, *limits = NULL, *tsens = NULL; char *key = NULL; struct device_node *node = pdev->dev.of_node; @@ -6351,8 +6351,9 @@ static int fetch_cpu_mitigaiton_info(struct msm_thermal_data *data, err = -ENOMEM; goto fetch_mitig_exit; } + sensor_name_len = strlen(sensor_name); strlcpy((char *) cpus[_cpu].sensor_type, sensor_name, - strlen(sensor_name) + 1); + sensor_name_len + 1); create_alias_name(_cpu, limits, pdev); } diff --git a/drivers/thermal/qpnp-temp-alarm.c b/drivers/thermal/qpnp-temp-alarm.c index 8c516da1d9ab..760205b107eb 100644 --- a/drivers/thermal/qpnp-temp-alarm.c +++ b/drivers/thermal/qpnp-temp-alarm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -544,12 +544,6 @@ static int qpnp_tm_probe(struct platform_device *pdev) int rc = 0; u8 raw_type[2], type, subtype; - if (!pdev || !(&pdev->dev) || !pdev->dev.of_node) { - dev_err(&pdev->dev, "%s: device tree node not found\n", - __func__); - return -EINVAL; - } - node = pdev->dev.of_node; chip = kzalloc(sizeof(struct qpnp_tm_chip), GFP_KERNEL); diff --git a/drivers/video/fbdev/msm/dsi_status_6g.c b/drivers/video/fbdev/msm/dsi_status_6g.c index d86110251925..8a962efcf2f0 100644 --- a/drivers/video/fbdev/msm/dsi_status_6g.c +++ b/drivers/video/fbdev/msm/dsi_status_6g.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2017, 2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index ce359b5c109b..72ca10f600a7 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -3994,7 +3994,7 @@ static int mdss_fb_set_par(struct fb_info *info) { struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par; struct fb_var_screeninfo *var = &info->var; - int old_imgType, old_format; + int old_imgType, old_format, out_format; int ret = 0; ret = mdss_fb_pan_idle(mfd); @@ -4078,9 +4078,9 @@ static int mdss_fb_set_par(struct fb_info *info) mfd->fbi->var.yres) * mfd->fb_page; old_format = mfd->panel_info->out_format; - mfd->panel_info->out_format = - mdss_grayscale_to_mdp_format(var->grayscale); - if (!IS_ERR_VALUE(mfd->panel_info->out_format)) { + out_format = mdss_grayscale_to_mdp_format(var->grayscale); + if (!IS_ERR_VALUE(out_format)) { + mfd->panel_info->out_format = out_format; if (old_format != mfd->panel_info->out_format) mfd->panel_reconfig = true; } |
