Skip to content

Commit

Permalink
doc firmware_sample_firmware_class.c: kmalloc + memset conversion to …
Browse files Browse the repository at this point in the history
…kzalloc

 Documentation/firmware_class/firmware_sample_firmware_class.c | 5246 -> 5211 (-35 bytes)

Signed-off-by: Mariusz Kozlowski <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mariusz Kozlowski authored and Linus Torvalds committed Oct 17, 2007
1 parent 392b7bc commit f035ac8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Documentation/firmware_class/firmware_sample_firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ static int fw_setup_class_device(struct class_device *class_dev,
const char *fw_name,
struct device *device)
{
int retval = 0;
struct firmware_priv *fw_priv = kmalloc(sizeof(struct firmware_priv),
GFP_KERNEL);
int retval;
struct firmware_priv *fw_priv;

if(!fw_priv){
fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL);
if (!fw_priv) {
retval = -ENOMEM;
goto out;
}
memset(fw_priv, 0, sizeof(*fw_priv));

memset(class_dev, 0, sizeof(*class_dev));

strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
Expand Down

0 comments on commit f035ac8

Please sign in to comment.