login
Header Space

 
 

[patch] kmalloc returns (void*), don't do type conversions

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Date: Wednesday, May 21, 2008 - 3:13 pm

Hello everybody,

as requested on http://kernelnewbies.org/KernelJanitors/Todo
here's a first patch that removes type conversion on
kmalloc() (which returns a (void*)):


It was done against current linus-git=20
(d40ace0c7b4a329f7d869d0fbf27435543bb2acc, if I'm not mistaken),
and looks like that:
    list_del(&bss->list);
    local->num_bss_info--;
  } else {
=2D   bss =3D (struct hostap_bss_info *)
=2D     kmalloc(sizeof(*bss), GFP_ATOMIC);
+   bss =3D kmalloc(sizeof(*bss), GFP_ATOMIC);
    if (bss =3D=3D NULL)
      return NULL;
  }


Most of the patch is auto-generated (by a script in=20
http://kernelnewbies.org/KernelJanitors/Todo/VoidPointerConvs);=20
but it is hand-changed in some parts to avoid checkpatch warnings:
=2D line length
=2D "foo* bar" to "foo *bar"
=2D space prohibited between function name and open parenthesis '('
  (like "sizeof (")

checkpatch didn't give any warnings or errors on this patch.
I tried a "make allyesconfig", but that gave some compile errors=20
that don't seem related to my changes:
	drivers/block/cciss_scsi.c:75: error: =E2=80=98MAX_CTLR=E2=80=99 undeclare=
d here (not in a function)
	drivers/block/cciss_scsi.c:76: error: field name not in record or union in=
itializer


Please tell me if that's the correct approach; I'm sorry that I=20
couldn't find out who the correct maintainer for these changes is.


Regards,

Phil


$ diffstat kmalloc-type-changes.patch
 arch/cris/arch-v32/mm/intmem.c                |   13 +++++--------
 arch/ia64/kernel/mca_drv.c                    |    4 ++--
 arch/powerpc/kernel/nvram_64.c                |    3 +--
 drivers/block/cciss.c                         |    3 +--
 drivers/block/cciss_scsi.c                    |    3 +--
 drivers/block/floppy.c                        |    3 +--
 drivers/i2c/i2c-dev.c                         |    3 +--
 drivers/isdn/capi/capidrv.c                   |    3 +--
 drivers/isdn/hisax/hfc_sx.c                   |    5 +++--
 drivers/media/video/vino.c                    |    8 ++++----
 drivers/message/i2o/i2o_config.c              |    3 +--
 drivers/mtd/maps/tqm8xxl.c                    |    2 +-
 drivers/net/gianfar.c                         |    6 ++----
 drivers/net/s2io.c                            |    4 ++--
 drivers/net/tulip/eeprom.c                    |    8 ++++----
 drivers/net/wireless/hostap/hostap_80211_rx.c |    3 +--
 drivers/net/wireless/hostap/hostap_ioctl.c    |    3 +--
 drivers/net/wireless/ipw2100.c                |   10 ++++------
 drivers/net/wireless/zd1211rw/zd_chip.c       |    2 +-
 drivers/s390/net/ctcm_mpc.c                   |    6 ++----
 drivers/s390/net/qeth_core_main.c             |    4 ++--
 drivers/scsi/osst.c                           |    5 ++---
 drivers/usb/storage/isd200.c                  |    3 +--
 fs/befs/btree.c                               |    4 ++--
 fs/ufs/util.c                                 |    3 +--
 net/ipv4/igmp.c                               |    3 +--
 net/ipv6/mcast.c                              |    3 +--
 net/sctp/protocol.c                           |    4 ++--
 security/selinux/ss/conditional.c             |    4 ++--
 29 files changed, 53 insertions(+), 75 deletions(-)
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] kmalloc returns (void*), don't do type conversions, Philipp Marek, (Wed May 21, 3:13 pm)
speck-geostationary