forked from Minki/linux
doc firmware_sample_firmware_class.c: kmalloc + memset conversion to kzalloc
Documentation/firmware_class/firmware_sample_firmware_class.c | 5246 -> 5211 (-35 bytes) Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
392b7bc13e
commit
f035ac821b
@ -109,15 +109,15 @@ static int fw_setup_class_device(struct class_device *class_dev,
|
|||||||
const char *fw_name,
|
const char *fw_name,
|
||||||
struct device *device)
|
struct device *device)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval;
|
||||||
struct firmware_priv *fw_priv = kmalloc(sizeof(struct firmware_priv),
|
struct firmware_priv *fw_priv;
|
||||||
GFP_KERNEL);
|
|
||||||
|
|
||||||
if(!fw_priv){
|
fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL);
|
||||||
|
if (!fw_priv) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memset(fw_priv, 0, sizeof(*fw_priv));
|
|
||||||
memset(class_dev, 0, sizeof(*class_dev));
|
memset(class_dev, 0, sizeof(*class_dev));
|
||||||
|
|
||||||
strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
|
strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
|
||||||
|
Loading…
Reference in New Issue
Block a user