mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
Char/Misc driver fixes for 5.17-rc2
Here are two small char/misc driver fixes for 5.17-rc2 that fix some
reported issues. They include:
- fix up a merge issue in the at25.c driver that ended up
dropping some lines in the driver. The removed lines ended
being needed, so this restores it and the driver works again.
- counter core fix where the wrong error was being returned,
NULL should be the correct error for when memory is gone here,
like the kmalloc() core does.
Both of these have been in linux-next this week with no reported issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-----BEGIN PGP SIGNATURE-----
iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYfU7Qg8cZ3JlZ0Brcm9h
aC5jb20ACgkQMUfUDdst+ymyqwCgr2af9iXxNWe2H4rC2ZbtIy93nPYAoI1XmpDd
uO8nm/Gt/h3bQXMCr3iA
=F1iZ
-----END PGP SIGNATURE-----
Merge tag 'char-misc-5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH:
"Here are two small char/misc driver fixes for 5.17-rc2 that fix some
reported issues. They are:
- fix up a merge issue in the at25.c driver that ended up dropping
some lines in the driver. The removed lines ended being needed, so
this restores it and the driver works again.
- counter core fix where the wrong error was being returned, NULL
should be the correct error for when memory is gone here, like the
kmalloc() core does.
Both of these have been in linux-next this week with no reported
issues"
* tag 'char-misc-5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
counter: fix an IS_ERR() vs NULL bug
eeprom: at25: Restore missing allocation
This commit is contained in:
commit
e255759e5a
|
|
@ -90,10 +90,8 @@ struct counter_device *counter_alloc(size_t sizeof_priv)
|
|||
int err;
|
||||
|
||||
ch = kzalloc(sizeof(*ch) + sizeof_priv, GFP_KERNEL);
|
||||
if (!ch) {
|
||||
err = -ENOMEM;
|
||||
goto err_alloc_ch;
|
||||
}
|
||||
if (!ch)
|
||||
return NULL;
|
||||
|
||||
counter = &ch->counter;
|
||||
dev = &counter->dev;
|
||||
|
|
@ -123,9 +121,8 @@ struct counter_device *counter_alloc(size_t sizeof_priv)
|
|||
err_ida_alloc:
|
||||
|
||||
kfree(ch);
|
||||
err_alloc_ch:
|
||||
|
||||
return ERR_PTR(err);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(counter_alloc);
|
||||
|
||||
|
|
@ -208,12 +205,12 @@ struct counter_device *devm_counter_alloc(struct device *dev, size_t sizeof_priv
|
|||
int err;
|
||||
|
||||
counter = counter_alloc(sizeof_priv);
|
||||
if (IS_ERR(counter))
|
||||
return counter;
|
||||
if (!counter)
|
||||
return NULL;
|
||||
|
||||
err = devm_add_action_or_reset(dev, devm_counter_put, counter);
|
||||
if (err < 0)
|
||||
return ERR_PTR(err);
|
||||
return NULL;
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -440,6 +440,10 @@ static int at25_probe(struct spi_device *spi)
|
|||
return -ENXIO;
|
||||
}
|
||||
|
||||
at25 = devm_kzalloc(&spi->dev, sizeof(*at25), GFP_KERNEL);
|
||||
if (!at25)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&at25->lock);
|
||||
at25->spi = spi;
|
||||
spi_set_drvdata(spi, at25);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user