Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1685905
| From | Alan Tull <atull@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 03/16] fpga: mgr: API change to replace fpga load functions with single function |
| Date | 2017-07-12 18:40 +0200 |
| Message-ID | <u2sQb-28X-53@gated-at.bofh.it> (permalink) |
| References | <u0k0F-Om-5@gated-at.bofh.it> <u0k0G-Om-43@gated-at.bofh.it> <u1KP8-7Xs-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jul 10, 2017 at 12:36 PM, Moritz Fischer
<moritz.fischer@ettus.com> wrote:
>> +struct fpga_image_info *fpga_image_info_alloc(struct device *dev)
>> +{
>> + struct fpga_image_info *info;
>> +
>> + info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
>> + if (!info)
>> + return ERR_PTR(-ENOMEM);
>
> Doesn't this make it more complex? If in the end you'll anyway have to check
> if IS_ERR_OR_NULL()? As opposed to just checking if (!info) on the returned
> value.
>
> Just a thought.
Also I should save a pointer to the device in fpga_image_info so that
fpga_image_info_free() could lose the dev param. I'd add this here:
get_device(dev);
info->dev = dev;
>
>> +
>> + return info;
>> +}
>> +EXPORT_SYMBOL_GPL(fpga_image_info_alloc);
>> +
>> +void fpga_image_info_free(struct device *dev,
>> + struct fpga_image_info *info)
I'd get rid of the dev parameter.
>> +{
struct device *dev;
>> + if (!info)
>> + return;
dev = info->dev;
>> +
>> + if (info->firmware_name)
>> + devm_kfree(dev, info->firmware_name);
>> +
>> + devm_kfree(dev, info);
put_device(dev);
>> +}
>> +EXPORT_SYMBOL_GPL(fpga_image_info_free);
And fix all uses of this function to be fpga_image_info_free(info);
Alan Tull
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/16] Enable upper layers using FPGA region w/o device tree Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 10/16] fpga: region: use image info as parameter for programming region Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 15/16] fpga: region: add fpga_region_class_find Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 01/16] doc: fpga: update documents for the FPGA API Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 08/16] fpga: region: check for child regions before allocing image info Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 16/16] fpga: region: move device tree support to of-fpga-region.c Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 12/16] fpga: region: add fpga-region.h header Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 05/16] fpga: region: use dev_err instead of pr_err Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
[PATCH v3 03/16] fpga: mgr: API change to replace fpga load functions with single function Alan Tull <atull@kernel.org> - 2017-07-06 20:50 +0200
Re: [PATCH v3 03/16] fpga: mgr: API change to replace fpga load functions with single function Moritz Fischer <moritz.fischer@ettus.com> - 2017-07-10 19:40 +0200
Re: [PATCH v3 03/16] fpga: mgr: API change to replace fpga load functions with single function Alan Tull <atull@kernel.org> - 2017-07-10 20:30 +0200
Re: [PATCH v3 03/16] fpga: mgr: API change to replace fpga load functions with single function Alan Tull <atull@kernel.org> - 2017-07-12 18:40 +0200
[PATCH v3 04/16] fpga: mgr: separate getting/locking FPGA manager Alan Tull <atull@kernel.org> - 2017-07-06 21:00 +0200
[PATCH v3 02/16] fpga: bridge: support getting bridge from device Alan Tull <atull@kernel.org> - 2017-07-06 21:00 +0200
[PATCH v3 06/16] fpga: region: remove unneeded of_node_get and put Alan Tull <atull@kernel.org> - 2017-07-06 21:00 +0200
csiph-web