[PATCH rfc] nvme-fabrics: request transport module

Sagi Grimberg sagi at grimberg.me
Sun Sep 24 06:03:55 PDT 2017


>> +
>> +	if (!strcmp(opts->transport, "rdma"))
>> +		mod_name = "nvme-rdma";
>> +	else if (!strcmp(opts->transport, "fc"))
>> +		mod_name = "nvme-fc";
>> +	else if (!strcmp(opts->transport, "loop"))
>> +		mod_name = "nvme-loop";
>> +	else
>> +		return -EINVAL;
>> +
>> +	ret = request_module(mod_name) < 0;
> 
> You can replace this whole function with:
> 
> 	request_module("nvme-%d", opts->transport);

Hahaha, how could I miss that?!

> Also if I remember correctly request_module returns an error if the
> driver is built-in, thus most callers either don't check the return
> value or just print a warning (I personally hate the warning, so I think
> we should just do the simple request_module call).

So skip the return value altogether? I don't mind that...



More information about the Linux-nvme mailing list