Skip to content

Commit 8cfda40

Browse files
committed
Merge tag 'qcom-drivers-for-6.11-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers
A few more Qualcomm driver updates for v6.11 This adds a quirk to skip using the newly introduced SHM Bridge implementation while regressions are being investigated. One occurance of return no_free_ptr() is replaced with return_ptr() to make code easier to read. llcc, mdt_loader, ocmem, pdr, socinfo and wcnss drivers gets simplified using cleanup.h. * tag 'qcom-drivers-for-6.11-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: firmware: qcom: tzmem: blacklist more platforms for SHM Bridge soc: qcom: wcnss: simplify with cleanup.h soc: qcom: pdr: simplify with cleanup.h soc: qcom: ocmem: simplify with cleanup.h soc: qcom: mdt_loader: simplify with cleanup.h soc: qcom: llcc: simplify with cleanup.h firmware: qcom: tzmem: simplify returning pointer without cleanup soc: qcom: socinfo: Add PM6350 PMIC Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 782b726 + 55751d3 commit 8cfda40

File tree

7 files changed

+31
-45
lines changed

7 files changed

+31
-45
lines changed

drivers/firmware/qcom/qcom_tzmem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ static bool qcom_tzmem_using_shm_bridge;
7878
/* List of machines that are known to not support SHM bridge correctly. */
7979
static const char *const qcom_tzmem_blacklist[] = {
8080
"qcom,sc8180x",
81+
"qcom,sdm845", /* reset in rmtfs memory assignment */
82+
"qcom,sm8150", /* reset in rmtfs memory assignment */
8183
NULL
8284
};
8385

@@ -242,7 +244,7 @@ qcom_tzmem_pool_new(const struct qcom_tzmem_pool_config *config)
242244
}
243245
}
244246

245-
return no_free_ptr(pool);
247+
return_ptr(pool);
246248
}
247249
EXPORT_SYMBOL_GPL(qcom_tzmem_pool_new);
248250

drivers/soc/qcom/llcc-qcom.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/bitfield.h>
88
#include <linux/bitmap.h>
99
#include <linux/bitops.h>
10+
#include <linux/cleanup.h>
1011
#include <linux/device.h>
1112
#include <linux/io.h>
1213
#include <linux/kernel.h>
@@ -1294,16 +1295,13 @@ static int qcom_llcc_probe(struct platform_device *pdev)
12941295

12951296
/* Initialize rest of LLCC bank regmaps */
12961297
for (i = 1; i < num_banks; i++) {
1297-
char *base = kasprintf(GFP_KERNEL, "llcc%d_base", i);
1298+
char *base __free(kfree) = kasprintf(GFP_KERNEL, "llcc%d_base", i);
12981299

12991300
drv_data->regmaps[i] = qcom_llcc_init_mmio(pdev, i, base);
13001301
if (IS_ERR(drv_data->regmaps[i])) {
13011302
ret = PTR_ERR(drv_data->regmaps[i]);
1302-
kfree(base);
13031303
goto err;
13041304
}
1305-
1306-
kfree(base);
13071305
}
13081306

13091307
drv_data->bcast_regmap = qcom_llcc_init_mmio(pdev, i, "llcc_broadcast_base");

drivers/soc/qcom/mdt_loader.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
88
*/
99

10+
#include <linux/cleanup.h>
1011
#include <linux/device.h>
1112
#include <linux/elf.h>
1213
#include <linux/firmware.h>
@@ -37,13 +38,12 @@ static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs,
3738
{
3839
const struct elf32_phdr *phdr = &phdrs[segment];
3940
const struct firmware *seg_fw;
40-
char *seg_name;
4141
ssize_t ret;
4242

4343
if (strlen(fw_name) < 4)
4444
return -EINVAL;
4545

46-
seg_name = kstrdup(fw_name, GFP_KERNEL);
46+
char *seg_name __free(kfree) = kstrdup(fw_name, GFP_KERNEL);
4747
if (!seg_name)
4848
return -ENOMEM;
4949

@@ -52,7 +52,6 @@ static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs,
5252
ptr, phdr->p_filesz);
5353
if (ret) {
5454
dev_err(dev, "error %zd loading %s\n", ret, seg_name);
55-
kfree(seg_name);
5655
return ret;
5756
}
5857

@@ -64,7 +63,6 @@ static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs,
6463
}
6564

6665
release_firmware(seg_fw);
67-
kfree(seg_name);
6866

6967
return ret;
7068
}

drivers/soc/qcom/ocmem.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <linux/bitfield.h>
13+
#include <linux/cleanup.h>
1314
#include <linux/clk.h>
1415
#include <linux/io.h>
1516
#include <linux/kernel.h>
@@ -216,7 +217,6 @@ EXPORT_SYMBOL_GPL(of_get_ocmem);
216217
struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
217218
unsigned long size)
218219
{
219-
struct ocmem_buf *buf;
220220
int ret;
221221

222222
/* TODO: add support for other clients... */
@@ -229,7 +229,7 @@ struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
229229
if (test_and_set_bit_lock(BIT(client), &ocmem->active_allocations))
230230
return ERR_PTR(-EBUSY);
231231

232-
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
232+
struct ocmem_buf *buf __free(kfree) = kzalloc(sizeof(*buf), GFP_KERNEL);
233233
if (!buf) {
234234
ret = -ENOMEM;
235235
goto err_unlock;
@@ -247,7 +247,7 @@ struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
247247
if (ret) {
248248
dev_err(ocmem->dev, "could not lock: %d\n", ret);
249249
ret = -EINVAL;
250-
goto err_kfree;
250+
goto err_unlock;
251251
}
252252
} else {
253253
ocmem_write(ocmem, OCMEM_REG_GFX_MPU_START, buf->offset);
@@ -258,10 +258,8 @@ struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
258258
dev_dbg(ocmem->dev, "using %ldK of OCMEM at 0x%08lx for client %d\n",
259259
size / 1024, buf->addr, client);
260260

261-
return buf;
261+
return_ptr(buf);
262262

263-
err_kfree:
264-
kfree(buf);
265263
err_unlock:
266264
clear_bit_unlock(BIT(client), &ocmem->active_allocations);
267265

drivers/soc/qcom/pdr_interface.c

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2020 The Linux Foundation. All rights reserved.
44
*/
55

6+
#include <linux/cleanup.h>
67
#include <linux/kernel.h>
78
#include <linux/module.h>
89
#include <linux/slab.h>
@@ -396,13 +397,13 @@ static int pdr_get_domain_list(struct servreg_get_domain_list_req *req,
396397

397398
static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
398399
{
399-
struct servreg_get_domain_list_resp *resp;
400400
struct servreg_get_domain_list_req req;
401401
struct servreg_location_entry *entry;
402402
int domains_read = 0;
403403
int ret, i;
404404

405-
resp = kzalloc(sizeof(*resp), GFP_KERNEL);
405+
struct servreg_get_domain_list_resp *resp __free(kfree) = kzalloc(sizeof(*resp),
406+
GFP_KERNEL);
406407
if (!resp)
407408
return -ENOMEM;
408409

@@ -415,7 +416,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
415416
req.domain_offset = domains_read;
416417
ret = pdr_get_domain_list(&req, resp, pdr);
417418
if (ret < 0)
418-
goto out;
419+
return ret;
419420

420421
for (i = 0; i < resp->domain_list_len; i++) {
421422
entry = &resp->domain_list[i];
@@ -427,7 +428,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
427428
pds->service_data_valid = entry->service_data_valid;
428429
pds->service_data = entry->service_data;
429430
pds->instance = entry->instance;
430-
goto out;
431+
return 0;
431432
}
432433
}
433434

@@ -440,8 +441,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
440441

441442
domains_read += resp->domain_list_len;
442443
} while (domains_read < resp->total_domains);
443-
out:
444-
kfree(resp);
444+
445445
return ret;
446446
}
447447

@@ -517,8 +517,7 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
517517
const char *service_name,
518518
const char *service_path)
519519
{
520-
struct pdr_service *pds, *tmp;
521-
int ret;
520+
struct pdr_service *tmp;
522521

523522
if (IS_ERR_OR_NULL(pdr))
524523
return ERR_PTR(-EINVAL);
@@ -527,7 +526,7 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
527526
!service_path || strlen(service_path) > SERVREG_NAME_LENGTH)
528527
return ERR_PTR(-EINVAL);
529528

530-
pds = kzalloc(sizeof(*pds), GFP_KERNEL);
529+
struct pdr_service *pds __free(kfree) = kzalloc(sizeof(*pds), GFP_KERNEL);
531530
if (!pds)
532531
return ERR_PTR(-ENOMEM);
533532

@@ -542,19 +541,15 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
542541
continue;
543542

544543
mutex_unlock(&pdr->list_lock);
545-
ret = -EALREADY;
546-
goto err;
544+
return ERR_PTR(-EALREADY);
547545
}
548546

549547
list_add(&pds->node, &pdr->lookups);
550548
mutex_unlock(&pdr->list_lock);
551549

552550
schedule_work(&pdr->locator_work);
553551

554-
return pds;
555-
err:
556-
kfree(pds);
557-
return ERR_PTR(ret);
552+
return_ptr(pds);
558553
}
559554
EXPORT_SYMBOL_GPL(pdr_add_lookup);
560555

@@ -651,13 +646,12 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
651646
char *service_path,
652647
void *priv), void *priv)
653648
{
654-
struct pdr_handle *pdr;
655649
int ret;
656650

657651
if (!status)
658652
return ERR_PTR(-EINVAL);
659653

660-
pdr = kzalloc(sizeof(*pdr), GFP_KERNEL);
654+
struct pdr_handle *pdr __free(kfree) = kzalloc(sizeof(*pdr), GFP_KERNEL);
661655
if (!pdr)
662656
return ERR_PTR(-ENOMEM);
663657

@@ -676,10 +670,8 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
676670
INIT_WORK(&pdr->indack_work, pdr_indack_work);
677671

678672
pdr->notifier_wq = create_singlethread_workqueue("pdr_notifier_wq");
679-
if (!pdr->notifier_wq) {
680-
ret = -ENOMEM;
681-
goto free_pdr_handle;
682-
}
673+
if (!pdr->notifier_wq)
674+
return ERR_PTR(-ENOMEM);
683675

684676
pdr->indack_wq = alloc_ordered_workqueue("pdr_indack_wq", WQ_HIGHPRI);
685677
if (!pdr->indack_wq) {
@@ -704,16 +696,14 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
704696
if (ret < 0)
705697
goto release_qmi_handle;
706698

707-
return pdr;
699+
return_ptr(pdr);
708700

709701
release_qmi_handle:
710702
qmi_handle_release(&pdr->locator_hdl);
711703
destroy_indack:
712704
destroy_workqueue(pdr->indack_wq);
713705
destroy_notifier:
714706
destroy_workqueue(pdr->notifier_wq);
715-
free_pdr_handle:
716-
kfree(pdr);
717707

718708
return ERR_PTR(ret);
719709
}

drivers/soc/qcom/socinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static const char *const pmic_models[] = {
116116
[50] = "PM8350B",
117117
[51] = "PMR735A",
118118
[52] = "PMR735B",
119+
[54] = "PM6350",
119120
[55] = "PM4125",
120121
[58] = "PM8450",
121122
[65] = "PM8010",

drivers/soc/qcom/wcnss_ctrl.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (c) 2016, Linaro Ltd.
44
* Copyright (c) 2015, Sony Mobile Communications Inc.
55
*/
6+
#include <linux/cleanup.h>
67
#include <linux/firmware.h>
78
#include <linux/module.h>
89
#include <linux/slab.h>
@@ -198,26 +199,26 @@ static int wcnss_request_version(struct wcnss_ctrl *wcnss)
198199
*/
199200
static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
200201
{
201-
struct wcnss_download_nv_req *req;
202202
const struct firmware *fw;
203203
struct device *dev = wcnss->dev;
204204
const char *nvbin = NVBIN_FILE;
205205
const void *data;
206206
ssize_t left;
207207
int ret;
208208

209-
req = kzalloc(sizeof(*req) + NV_FRAGMENT_SIZE, GFP_KERNEL);
209+
struct wcnss_download_nv_req *req __free(kfree) = kzalloc(sizeof(*req) + NV_FRAGMENT_SIZE,
210+
GFP_KERNEL);
210211
if (!req)
211212
return -ENOMEM;
212213

213214
ret = of_property_read_string(dev->of_node, "firmware-name", &nvbin);
214215
if (ret < 0 && ret != -EINVAL)
215-
goto free_req;
216+
return ret;
216217

217218
ret = request_firmware(&fw, nvbin, dev);
218219
if (ret < 0) {
219220
dev_err(dev, "Failed to load nv file %s: %d\n", nvbin, ret);
220-
goto free_req;
221+
return ret;
221222
}
222223

223224
data = fw->data;
@@ -263,8 +264,6 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
263264

264265
release_fw:
265266
release_firmware(fw);
266-
free_req:
267-
kfree(req);
268267

269268
return ret;
270269
}

0 commit comments

Comments
 (0)