HSI changes for the v4.13 series

* misc. cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAllbWKUACgkQ2O7X88g7
 +pr69A//WKi6MoFPPlQs6ONfNWSVLGkeCTbMixTLQm0T8Jp3DtsOuNlXaLDYzUCm
 BRAD9KAaDce6XyLxCOwx5CdYOpTJa5EiGA6jCp/GlBUzxw8GDjQnmuWmR2nMFT9O
 H+9w7aEhALj5z/BPItYr28jes/lq33iF87S+VOdXzM4DFnHepOWZyWTHSYVOcKOg
 Ev8xJXLVWxpDblEM7GaQzAVWGvWtgbjCd2FEvlNEWQRLg9IWRVut+F84x/QQGlZA
 cmXzX80fs91+LpgD0+10x9iUX84jLhWFx+GePjIFSYWTm3XOpV226ufJuaRjhejs
 QN21oEpLnlZ1XF6T3q/xFwJgHjQP/EedEiVUt+FWAqInD7xZQJRNds//jlGU/TXd
 QROy22JefHoPQlbZ09SP9Pq6w7mZcPmKux3BCdWcOoSne47hYJrU105cR6vbRDF2
 pYH6J2tZfiemMvFtnEJJuiDIklh1OrMlunQy9+0A4bRJZKtS3hp5eDuw4CmieXip
 TVGMYGmyTMdut2qSGg6VarST2kdMvbfWC3Raz21ff2kDReiseHR00z+laLqs78SA
 VnyqRMVXWyHrvpGrIJPveO77W2/ywq/fI0Lib8aAyIWkNq+2OvKuODfiQTimBc9z
 KgYZ5xQW4SjNm4Se2GiNiCwURgrwx5Y1u9X3RkZjVtInbfPNj8o=
 =8HaP
 -----END PGP SIGNATURE-----

Merge tag 'hsi-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi

Pull HSI updates from Sebastian Reichel:
 "Misc cleanups"

* tag 'hsi-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
  HSI: core: Use kcalloc() in two functions
  HSI: Use kcalloc() in hsi_register_board_info()
  HSI: omap_ssi: Delete an error message for a failed memory allocation in ssi_add_controller()
  HSI: omap_ssi: Fix a typo in a comment line
  HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller()
  HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe()
  HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions
  HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
This commit is contained in:
Linus Torvalds 2017-07-04 14:28:22 -07:00
commit c9946d014f
4 changed files with 14 additions and 20 deletions

View File

@ -102,12 +102,10 @@ static int nokia_modem_gpio_probe(struct device *dev)
return -EINVAL;
}
modem->gpios = devm_kzalloc(dev, gpio_count *
sizeof(struct nokia_modem_gpio), GFP_KERNEL);
if (!modem->gpios) {
dev_err(dev, "Could not allocate memory for gpios\n");
modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios),
GFP_KERNEL);
if (!modem->gpios)
return -ENOMEM;
}
modem->gpio_amount = gpio_count;
@ -156,10 +154,9 @@ static int nokia_modem_probe(struct device *dev)
}
modem = devm_kzalloc(dev, sizeof(*modem), GFP_KERNEL);
if (!modem) {
dev_err(dev, "Could not allocate memory for nokia_modem_device\n");
if (!modem)
return -ENOMEM;
}
dev_set_drvdata(dev, modem);
modem->device = dev;
@ -182,7 +179,7 @@ static int nokia_modem_probe(struct device *dev)
}
enable_irq_wake(irq);
if(pm) {
if (pm) {
err = nokia_modem_gpio_probe(dev);
if (err < 0) {
dev_err(dev, "Could not probe GPIOs\n");

View File

@ -384,10 +384,8 @@ static int ssi_add_controller(struct hsi_controller *ssi,
int err;
omap_ssi = devm_kzalloc(&ssi->device, sizeof(*omap_ssi), GFP_KERNEL);
if (!omap_ssi) {
dev_err(&pd->dev, "not enough memory for omap ssi\n");
if (!omap_ssi)
return -ENOMEM;
}
err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL);
if (err < 0)
@ -421,8 +419,8 @@ static int ssi_add_controller(struct hsi_controller *ssi,
goto out_err;
}
omap_ssi->port = devm_kzalloc(&ssi->device,
sizeof(struct omap_ssi_port *) * ssi->num_ports, GFP_KERNEL);
omap_ssi->port = devm_kcalloc(&ssi->device, ssi->num_ports,
sizeof(*omap_ssi->port), GFP_KERNEL);
if (!omap_ssi->port) {
err = -ENOMEM;
goto out_err;
@ -467,7 +465,7 @@ static int ssi_hw_init(struct hsi_controller *ssi)
dev_err(&ssi->device, "runtime PM failed %d\n", err);
return err;
}
/* Reseting GDD */
/* Resetting GDD */
writel_relaxed(SSI_SWRESET, omap_ssi->gdd + SSI_GDD_GRST_REG);
/* Get FCK rate in KHz */
omap_ssi->fck_rate = DIV_ROUND_CLOSEST(ssi_get_clk_rate(ssi), 1000);

View File

@ -49,7 +49,7 @@ int __init hsi_register_board_info(struct hsi_board_info const *info,
{
struct hsi_cl_info *cl_info;
cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL);
cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL);
if (!cl_info)
return -ENOMEM;

View File

@ -267,14 +267,13 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
cl->rx_cfg.num_channels = cells;
cl->tx_cfg.num_channels = cells;
cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL);
cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
if (!cl->rx_cfg.channels) {
err = -ENOMEM;
goto err;
}
cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL);
cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
if (!cl->tx_cfg.channels) {
err = -ENOMEM;
goto err2;
@ -485,7 +484,7 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags)
hsi = kzalloc(sizeof(*hsi), flags);
if (!hsi)
return NULL;
port = kzalloc(sizeof(*port)*n_ports, flags);
port = kcalloc(n_ports, sizeof(*port), flags);
if (!port) {
kfree(hsi);
return NULL;