Skip to content

Commit 50f09a3

Browse files
committed
Merge tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here is a big set of char/misc/other driver fixes for 5.13-rc3. The majority here is the fallout of the umn.edu re-review of all prior submissions. That resulted in a bunch of reverts along with the "correct" changes made, such that there is no regression of any of the potential fixes that were made by those individuals. I would like to thank the over 80 different developers who helped with the review and fixes for this mess. Other than that, there's a few habanna driver fixes for reported issues, and some dyndbg fixes for reported problems. All of these have been in linux-next for a while with no reported problems" * tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (82 commits) misc: eeprom: at24: check suspend status before disable regulator uio_hv_generic: Fix another memory leak in error handling paths uio_hv_generic: Fix a memory leak in error handling paths uio/uio_pci_generic: fix return value changed in refactoring Revert "Revert "ALSA: usx2y: Fix potential NULL pointer dereference"" dyndbg: drop uninformative vpr_info dyndbg: avoid calling dyndbg_emit_prefix when it has no work binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION cdrom: gdrom: initialize global variable at init time brcmfmac: properly check for bus register errors Revert "brcmfmac: add a check for the status of usb_register" video: imsttfb: check for ioremap() failures Revert "video: imsttfb: fix potential NULL pointer dereferences" net: liquidio: Add missing null pointer checks Revert "net: liquidio: fix a NULL pointer dereference" media: gspca: properly check for errors in po1030_probe() Revert "media: gspca: Check the return value of write_bridge for timeout" media: gspca: mt9m111: Check write_bridge for timeout Revert "media: gspca: mt9m111: Check write_bridge for timeout" media: dvb: Add check on sp8870_readreg return ...
2 parents 7ac1771 + 2962484 commit 50f09a3

File tree

59 files changed

+499
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+499
-417
lines changed

drivers/android/binder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4918,7 +4918,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
49184918
uint32_t enable;
49194919

49204920
if (copy_from_user(&enable, ubuf, sizeof(enable))) {
4921-
ret = -EINVAL;
4921+
ret = -EFAULT;
49224922
goto err;
49234923
}
49244924
binder_inner_proc_lock(proc);

drivers/cdrom/gdrom.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,13 @@ static const struct blk_mq_ops gdrom_mq_ops = {
744744
static int probe_gdrom(struct platform_device *devptr)
745745
{
746746
int err;
747+
748+
/*
749+
* Ensure our "one" device is initialized properly in case of previous
750+
* usages of it
751+
*/
752+
memset(&gd, 0, sizeof(gd));
753+
747754
/* Start the device */
748755
if (gdrom_execute_diagnostic() != 1) {
749756
pr_warn("ATA Probe for GDROM failed\n");
@@ -830,6 +837,8 @@ static int remove_gdrom(struct platform_device *devptr)
830837
if (gdrom_major)
831838
unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
832839
unregister_cdrom(gd.cd_info);
840+
kfree(gd.cd_info);
841+
kfree(gd.toc);
833842

834843
return 0;
835844
}
@@ -845,7 +854,7 @@ static struct platform_driver gdrom_driver = {
845854
static int __init init_gdrom(void)
846855
{
847856
int rc;
848-
gd.toc = NULL;
857+
849858
rc = platform_driver_register(&gdrom_driver);
850859
if (rc)
851860
return rc;
@@ -861,8 +870,6 @@ static void __exit exit_gdrom(void)
861870
{
862871
platform_device_unregister(pd);
863872
platform_driver_unregister(&gdrom_driver);
864-
kfree(gd.toc);
865-
kfree(gd.cd_info);
866873
}
867874

868875
module_init(init_gdrom);

drivers/char/hpet.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
984984
hdp->hd_phys_address = fixmem32->address;
985985
hdp->hd_address = ioremap(fixmem32->address,
986986
HPET_RANGE_SIZE);
987+
if (!hdp->hd_address)
988+
return AE_ERROR;
987989

988990
if (hpet_is_known(hdp)) {
989991
iounmap(hdp->hd_address);

drivers/crypto/cavium/nitrox/nitrox_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ static int nitrox_probe(struct pci_dev *pdev,
442442
err = pci_request_mem_regions(pdev, nitrox_driver_name);
443443
if (err) {
444444
pci_disable_device(pdev);
445-
dev_err(&pdev->dev, "Failed to request mem regions!\n");
446445
return err;
447446
}
448447
pci_set_master(pdev);

drivers/dma/qcom/hidma_mgmt.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,23 @@ static int __init hidma_mgmt_init(void)
418418
hidma_mgmt_of_populate_channels(child);
419419
}
420420
#endif
421-
return platform_driver_register(&hidma_mgmt_driver);
421+
/*
422+
* We do not check for return value here, as it is assumed that
423+
* platform_driver_register must not fail. The reason for this is that
424+
* the (potential) hidma_mgmt_of_populate_channels calls above are not
425+
* cleaned up if it does fail, and to do this work is quite
426+
* complicated. In particular, various calls of of_address_to_resource,
427+
* of_irq_to_resource, platform_device_register_full, of_dma_configure,
428+
* and of_msi_configure which then call other functions and so on, must
429+
* be cleaned up - this is not a trivial exercise.
430+
*
431+
* Currently, this module is not intended to be unloaded, and there is
432+
* no module_exit function defined which does the needed cleanup. For
433+
* this reason, we have to assume success here.
434+
*/
435+
platform_driver_register(&hidma_mgmt_driver);
422436

437+
return 0;
423438
}
424439
module_init(hidma_mgmt_init);
425440
MODULE_LICENSE("GPL v2");

drivers/hwmon/lm80.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ static int lm80_probe(struct i2c_client *client)
596596
struct device *dev = &client->dev;
597597
struct device *hwmon_dev;
598598
struct lm80_data *data;
599-
int rv;
600599

601600
data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL);
602601
if (!data)
@@ -609,14 +608,8 @@ static int lm80_probe(struct i2c_client *client)
609608
lm80_init_client(client);
610609

611610
/* A few vars need to be filled upon startup */
612-
rv = lm80_read_value(client, LM80_REG_FAN_MIN(1));
613-
if (rv < 0)
614-
return rv;
615-
data->fan[f_min][0] = rv;
616-
rv = lm80_read_value(client, LM80_REG_FAN_MIN(2));
617-
if (rv < 0)
618-
return rv;
619-
data->fan[f_min][1] = rv;
611+
data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
612+
data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
620613

621614
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
622615
data, lm80_groups);

drivers/isdn/hardware/mISDN/hfcsusb.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static void hfcsusb_start_endpoint(struct hfcsusb *hw, int channel);
4646
static void hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel);
4747
static int hfcsusb_setup_bch(struct bchannel *bch, int protocol);
4848
static void deactivate_bchannel(struct bchannel *bch);
49-
static void hfcsusb_ph_info(struct hfcsusb *hw);
49+
static int hfcsusb_ph_info(struct hfcsusb *hw);
5050

5151
/* start next background transfer for control channel */
5252
static void
@@ -241,7 +241,7 @@ hfcusb_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb)
241241
* send full D/B channel status information
242242
* as MPH_INFORMATION_IND
243243
*/
244-
static void
244+
static int
245245
hfcsusb_ph_info(struct hfcsusb *hw)
246246
{
247247
struct ph_info *phi;
@@ -250,7 +250,7 @@ hfcsusb_ph_info(struct hfcsusb *hw)
250250

251251
phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
252252
if (!phi)
253-
return;
253+
return -ENOMEM;
254254

255255
phi->dch.ch.protocol = hw->protocol;
256256
phi->dch.ch.Flags = dch->Flags;
@@ -263,6 +263,8 @@ hfcsusb_ph_info(struct hfcsusb *hw)
263263
_queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY,
264264
struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC);
265265
kfree(phi);
266+
267+
return 0;
266268
}
267269

268270
/*
@@ -347,8 +349,7 @@ hfcusb_l2l1D(struct mISDNchannel *ch, struct sk_buff *skb)
347349
ret = l1_event(dch->l1, hh->prim);
348350
break;
349351
case MPH_INFORMATION_REQ:
350-
hfcsusb_ph_info(hw);
351-
ret = 0;
352+
ret = hfcsusb_ph_info(hw);
352353
break;
353354
}
354355

@@ -403,8 +404,7 @@ hfc_l1callback(struct dchannel *dch, u_int cmd)
403404
hw->name, __func__, cmd);
404405
return -1;
405406
}
406-
hfcsusb_ph_info(hw);
407-
return 0;
407+
return hfcsusb_ph_info(hw);
408408
}
409409

410410
static int
@@ -746,8 +746,7 @@ hfcsusb_setup_bch(struct bchannel *bch, int protocol)
746746
handle_led(hw, (bch->nr == 1) ? LED_B1_OFF :
747747
LED_B2_OFF);
748748
}
749-
hfcsusb_ph_info(hw);
750-
return 0;
749+
return hfcsusb_ph_info(hw);
751750
}
752751

753752
static void

drivers/isdn/hardware/mISDN/mISDNinfineon.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -630,17 +630,19 @@ static void
630630
release_io(struct inf_hw *hw)
631631
{
632632
if (hw->cfg.mode) {
633-
if (hw->cfg.p) {
633+
if (hw->cfg.mode == AM_MEMIO) {
634634
release_mem_region(hw->cfg.start, hw->cfg.size);
635-
iounmap(hw->cfg.p);
635+
if (hw->cfg.p)
636+
iounmap(hw->cfg.p);
636637
} else
637638
release_region(hw->cfg.start, hw->cfg.size);
638639
hw->cfg.mode = AM_NONE;
639640
}
640641
if (hw->addr.mode) {
641-
if (hw->addr.p) {
642+
if (hw->addr.mode == AM_MEMIO) {
642643
release_mem_region(hw->addr.start, hw->addr.size);
643-
iounmap(hw->addr.p);
644+
if (hw->addr.p)
645+
iounmap(hw->addr.p);
644646
} else
645647
release_region(hw->addr.start, hw->addr.size);
646648
hw->addr.mode = AM_NONE;
@@ -670,9 +672,12 @@ setup_io(struct inf_hw *hw)
670672
(ulong)hw->cfg.start, (ulong)hw->cfg.size);
671673
return err;
672674
}
673-
if (hw->ci->cfg_mode == AM_MEMIO)
674-
hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size);
675675
hw->cfg.mode = hw->ci->cfg_mode;
676+
if (hw->ci->cfg_mode == AM_MEMIO) {
677+
hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size);
678+
if (!hw->cfg.p)
679+
return -ENOMEM;
680+
}
676681
if (debug & DEBUG_HW)
677682
pr_notice("%s: IO cfg %lx (%lu bytes) mode%d\n",
678683
hw->name, (ulong)hw->cfg.start,
@@ -697,12 +702,12 @@ setup_io(struct inf_hw *hw)
697702
(ulong)hw->addr.start, (ulong)hw->addr.size);
698703
return err;
699704
}
705+
hw->addr.mode = hw->ci->addr_mode;
700706
if (hw->ci->addr_mode == AM_MEMIO) {
701707
hw->addr.p = ioremap(hw->addr.start, hw->addr.size);
702-
if (unlikely(!hw->addr.p))
708+
if (!hw->addr.p)
703709
return -ENOMEM;
704710
}
705-
hw->addr.mode = hw->ci->addr_mode;
706711
if (debug & DEBUG_HW)
707712
pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n",
708713
hw->name, (ulong)hw->addr.start,

drivers/leds/leds-lp5523.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)
307307
usleep_range(3000, 6000);
308308
ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
309309
if (ret)
310-
return ret;
310+
goto out;
311311
status &= LP5523_ENG_STATUS_MASK;
312312

313313
if (status != LP5523_ENG_STATUS_MASK) {

drivers/media/dvb-frontends/sp8870.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int sp8870_set_frontend_parameters(struct dvb_frontend *fe)
281281

282282
// read status reg in order to clear pending irqs
283283
err = sp8870_readreg(state, 0x200);
284-
if (err)
284+
if (err < 0)
285285
return err;
286286

287287
// system controller start

0 commit comments

Comments
 (0)