Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685921

Re: [PATCH v2] [media] staging/imx: remove confusing IS_ERR_OR_NULL usage

From Steve Longerbeam <slongerbeam@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] [media] staging/imx: remove confusing IS_ERR_OR_NULL usage
Date 2017-07-12 19:20 +0200
Message-ID <u2tsS-2Fq-19@gated-at.bofh.it> (permalink)
References <u23oK-2Qv-19@gated-at.bofh.it> <u2sdr-1H6-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 07/12/2017 08:50 AM, Philipp Zabel wrote:
> On Tue, 2017-07-11 at 15:18 +0200, Arnd Bergmann wrote:
>> While looking at a compiler warning, I noticed the use of
>> IS_ERR_OR_NULL, which is generally a sign of a bad API design
>> and should be avoided.
>>
>> In this driver, this is fairly easy, we can simply stop storing
>> error pointers in persistent structures, and change the two
>> functions that might return either a NULL pointer or an error
>> code to consistently return error pointers when failing.
>>
>> of_parse_subdev() now separates the error code and the pointer
>> it looks up, to clarify the interface. There are two cases
>> where this function originally returns 'NULL', and I have
>> changed that to '0' for success to keep the current behavior,
>> though returning an error would also make sense there.
>>
>> Fixes: e130291212df ("[media] media: Add i.MX media core driver")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> v2: fix type mismatch
>> v3: rework of_parse_subdev() as well.
> 
> Thanks!
> 
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
> 

Looks fine to me. Tested on SabreAuto with affected pipelines.

Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] [media] staging/imx: remove confusing IS_ERR_OR_NULL usage Arnd Bergmann <arnd@arndb.de> - 2017-07-11 15:30 +0200
  Re: [PATCH v2] [media] staging/imx: remove confusing IS_ERR_OR_NULL  usage Philipp Zabel <p.zabel@pengutronix.de> - 2017-07-12 18:00 +0200
    Re: [PATCH v2] [media] staging/imx: remove confusing IS_ERR_OR_NULL  usage Steve Longerbeam <slongerbeam@gmail.com> - 2017-07-12 19:20 +0200

csiph-web