Re: [1/9] driver core fixes: make_class_name() retval check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cornelia Huck wrote:
> From: Cornelia Huck <[email protected]>
>
> Make make_class_name() return NULL on error and fixup callers in the
> driver core.

> @@ -409,8 +409,11 @@ static int make_deprecated_class_device_
>  		return 0;
>
>  	class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
> -	error = sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
> -				  class_name);
> +	if (!class_name)
> +		error = sysfs_create_link(&class_dev->dev->kobj,
> +					  &class_dev->kobj, class_name);
> +	else
> +		error = -ENOMEM;
>  	kfree(class_name);
>  	return error;
>  }

Either this is inverse of what you wanted to do or just calling 
sysfs_create_link(..., NULL) would make it clearer for readers.

Eike

Attachment: pgp2szFW43GEd.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux