* [PATCH 0/5] Use IS_ERR() rather than a NULL check when necessary.
@ 2012-12-12 0:24 Cyril Roelandt
2012-12-12 0:24 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_therm Cyril Roelandt
` (4 more replies)
0 siblings, 5 replies; 17+ messages in thread
From: Cyril Roelandt @ 2012-12-12 0:24 UTC (permalink / raw)
To: linux-kernel; +Cc: kernel-janitors, Cyril Roelandt
The following five patches replace NULL checks by calls to IS_ERR() when
checking the return values of functions that return ERR_PTR() on error.
Regards,
Cyril Roelandt.
---
Cyril Roelandt (5):
staging: omap-thermal: fix error check in
omap_thermal_expose_sensor() and in
omap_thermal_register_cpu_cooling().
media: davinci: fix return value check in vpbe_display_reqbufs().
c2port: fix return value check in duramar2150_c2port_init().
net: sfc: fix return value check in efx_ptp_probe_channel().
spi: fix return value check in hspi_probe().
drivers/media/platform/davinci/vpbe_display.c | 2 +-
drivers/misc/c2port/c2port-duramar2150.c | 2 +-
drivers/net/ethernet/sfc/ptp.c | 2 +-
drivers/spi/spi-sh-hspi.c | 2 +-
drivers/staging/omap-thermal/omap-thermal-common.c | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_therm 2012-12-12 0:24 [PATCH 0/5] Use IS_ERR() rather than a NULL check when necessary Cyril Roelandt @ 2012-12-12 0:24 ` Cyril Roelandt 2012-12-12 6:51 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_t Eduardo Valentin 2012-12-12 0:24 ` [PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs() Cyril Roelandt ` (3 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Cyril Roelandt @ 2012-12-12 0:24 UTC (permalink / raw) To: linux-kernel Cc: kernel-janitors, Cyril Roelandt, gregkh, eduardo.valentin, rui.zhang, durgadoss.r, rjw, devel The omap_bandgap_get_sensor_data() function returns ERR_PTR(), so we need to use IS_ERR() rather than a NULL check. Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> --- drivers/staging/omap-thermal/omap-thermal-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/omap-thermal/omap-thermal-common.c b/drivers/staging/omap-thermal/omap-thermal-common.c index 61f1070..79a55aa 100644 --- a/drivers/staging/omap-thermal/omap-thermal-common.c +++ b/drivers/staging/omap-thermal/omap-thermal-common.c @@ -260,7 +260,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, data = omap_bandgap_get_sensor_data(bg_ptr, id); - if (!data) + if (IS_ERR(data)) data = omap_thermal_build_data(bg_ptr, id); if (!data) @@ -309,7 +309,7 @@ int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id) struct omap_thermal_data *data; data = omap_bandgap_get_sensor_data(bg_ptr, id); - if (!data) + if (IS_ERR(data)) data = omap_thermal_build_data(bg_ptr, id); if (!data) -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_t 2012-12-12 0:24 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_therm Cyril Roelandt @ 2012-12-12 6:51 ` Eduardo Valentin 0 siblings, 0 replies; 17+ messages in thread From: Eduardo Valentin @ 2012-12-12 6:51 UTC (permalink / raw) To: Cyril Roelandt Cc: linux-kernel, kernel-janitors, gregkh, rui.zhang, durgadoss.r, rjw, devel On 12-12-2012 02:24, Cyril Roelandt wrote: > > The omap_bandgap_get_sensor_data() function returns ERR_PTR(), so we need to use > IS_ERR() rather than a NULL check. > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> > --- > drivers/staging/omap-thermal/omap-thermal-common.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/omap-thermal/omap-thermal-common.c b/drivers/staging/omap-thermal/omap-thermal-common.c > index 61f1070..79a55aa 100644 > --- a/drivers/staging/omap-thermal/omap-thermal-common.c > +++ b/drivers/staging/omap-thermal/omap-thermal-common.c > @@ -260,7 +260,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id, > > data = omap_bandgap_get_sensor_data(bg_ptr, id); > > - if (!data) > + if (IS_ERR(data)) > data = omap_thermal_build_data(bg_ptr, id); > > if (!data) > @@ -309,7 +309,7 @@ int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id) > struct omap_thermal_data *data; > > data = omap_bandgap_get_sensor_data(bg_ptr, id); > - if (!data) > + if (IS_ERR(data)) > data = omap_thermal_build_data(bg_ptr, id); > > if (!data) > ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs(). 2012-12-12 0:24 [PATCH 0/5] Use IS_ERR() rather than a NULL check when necessary Cyril Roelandt 2012-12-12 0:24 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_therm Cyril Roelandt @ 2012-12-12 0:24 ` Cyril Roelandt 2012-12-12 5:22 ` Prabhakar Lad 2012-12-12 0:24 ` [PATCH 3/5] c2port: fix return value check in duramar2150_c2port_init() Cyril Roelandt ` (2 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Cyril Roelandt @ 2012-12-12 0:24 UTC (permalink / raw) To: linux-kernel Cc: kernel-janitors, Cyril Roelandt, manjunath.hadli, prabhakar.lad, mchehab, linux-media, davinci-linux-open-source vb2_dma_contig_init_ctx() returns ERR_PTR and never returns NULL, so IS_ERR should be used instead of a NULL check. Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> --- drivers/media/platform/davinci/vpbe_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 2bfde79..2db4eff 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -1393,7 +1393,7 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, } /* Initialize videobuf queue as per the buffer type */ layer->alloc_ctx = vb2_dma_contig_init_ctx(vpbe_dev->pdev); - if (!layer->alloc_ctx) { + if (IS_ERR(layer->alloc_ctx)) { v4l2_err(&vpbe_dev->v4l2_dev, "Failed to get the context\n"); return -EINVAL; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs(). 2012-12-12 0:24 ` [PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs() Cyril Roelandt @ 2012-12-12 5:22 ` Prabhakar Lad 0 siblings, 0 replies; 17+ messages in thread From: Prabhakar Lad @ 2012-12-12 5:22 UTC (permalink / raw) To: Cyril Roelandt Cc: linux-kernel, kernel-janitors, Prabhakar Lad, mchehab, linux-media, davinci-linux-open-source Hi Cyril, On Wed, Dec 12, 2012 at 5:54 AM, Cyril Roelandt <tipecaml@gmail.com> wrote: > vb2_dma_contig_init_ctx() returns ERR_PTR and never returns NULL, so IS_ERR > should be used instead of a NULL check. > patch fixing this issue has been already posted with a better fix https://patchwork.kernel.org/patch/1830231/ Regards, --Prabhakar Lad > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > --- > drivers/media/platform/davinci/vpbe_display.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c > index 2bfde79..2db4eff 100644 > --- a/drivers/media/platform/davinci/vpbe_display.c > +++ b/drivers/media/platform/davinci/vpbe_display.c > @@ -1393,7 +1393,7 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, > } > /* Initialize videobuf queue as per the buffer type */ > layer->alloc_ctx = vb2_dma_contig_init_ctx(vpbe_dev->pdev); > - if (!layer->alloc_ctx) { > + if (IS_ERR(layer->alloc_ctx)) { > v4l2_err(&vpbe_dev->v4l2_dev, "Failed to get the context\n"); > return -EINVAL; > } > -- > 1.7.10.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/5] c2port: fix return value check in duramar2150_c2port_init(). 2012-12-12 0:24 [PATCH 0/5] Use IS_ERR() rather than a NULL check when necessary Cyril Roelandt 2012-12-12 0:24 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_therm Cyril Roelandt 2012-12-12 0:24 ` [PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs() Cyril Roelandt @ 2012-12-12 0:24 ` Cyril Roelandt 2012-12-12 0:24 ` [PATCH 4/5] net: sfc: fix return value check in efx_ptp_probe_channel() Cyril Roelandt [not found] ` <1355271894-5284-1-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 4 siblings, 0 replies; 17+ messages in thread From: Cyril Roelandt @ 2012-12-12 0:24 UTC (permalink / raw) To: linux-kernel; +Cc: kernel-janitors, Cyril Roelandt, paul.gortmaker, gregkh The c2port_device_register() function returns ERR_PTR() and never returns NULL, so the NULL check should be replaced by a call to IS_ERR(). Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> --- drivers/misc/c2port/c2port-duramar2150.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/c2port/c2port-duramar2150.c b/drivers/misc/c2port/c2port-duramar2150.c index 5484301..2742e60 100644 --- a/drivers/misc/c2port/c2port-duramar2150.c +++ b/drivers/misc/c2port/c2port-duramar2150.c @@ -129,7 +129,7 @@ static int __init duramar2150_c2port_init(void) duramar2150_c2port_dev = c2port_device_register("uc", &duramar2150_c2port_ops, NULL); - if (!duramar2150_c2port_dev) { + if (IS_ERR(duramar2150_c2port_dev)) { ret = -ENODEV; goto free_region; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/5] net: sfc: fix return value check in efx_ptp_probe_channel(). 2012-12-12 0:24 [PATCH 0/5] Use IS_ERR() rather than a NULL check when necessary Cyril Roelandt ` (2 preceding siblings ...) 2012-12-12 0:24 ` [PATCH 3/5] c2port: fix return value check in duramar2150_c2port_init() Cyril Roelandt @ 2012-12-12 0:24 ` Cyril Roelandt 2012-12-12 5:15 ` David Miller [not found] ` <1355271894-5284-1-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 4 siblings, 1 reply; 17+ messages in thread From: Cyril Roelandt @ 2012-12-12 0:24 UTC (permalink / raw) To: linux-kernel Cc: kernel-janitors, Cyril Roelandt, linux-net-drivers, bhutchings, netdev The ptp_clock_register() returns ERR_PTR() and never returns NULL. Replace the NULL check by a call to IS_ERR(). Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> --- drivers/net/ethernet/sfc/ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 0767043f..9bcc38c 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -930,7 +930,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel) ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info, &efx->pci_dev->dev); - if (!ptp->phc_clock) + if (IS_ERR(ptp->phc_clock)) goto fail3; INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] net: sfc: fix return value check in efx_ptp_probe_channel(). 2012-12-12 0:24 ` [PATCH 4/5] net: sfc: fix return value check in efx_ptp_probe_channel() Cyril Roelandt @ 2012-12-12 5:15 ` David Miller 2012-12-21 3:09 ` Ben Hutchings 0 siblings, 1 reply; 17+ messages in thread From: David Miller @ 2012-12-12 5:15 UTC (permalink / raw) To: tipecaml Cc: linux-kernel, kernel-janitors, linux-net-drivers, bhutchings, netdev From: Cyril Roelandt <tipecaml@gmail.com> Date: Wed, 12 Dec 2012 01:24:53 +0100 > The ptp_clock_register() returns ERR_PTR() and never returns NULL. Replace the > NULL check by a call to IS_ERR(). > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> I'll let Ben queue this up. Probably he'll want to avoid potentially leaving an ERR_PTR in ptp->phc_clock even if, with this fix, that would be harmless. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] net: sfc: fix return value check in efx_ptp_probe_channel(). 2012-12-12 5:15 ` David Miller @ 2012-12-21 3:09 ` Ben Hutchings 0 siblings, 0 replies; 17+ messages in thread From: Ben Hutchings @ 2012-12-21 3:09 UTC (permalink / raw) To: David Miller, tipecaml Cc: linux-kernel, kernel-janitors, linux-net-drivers, netdev On Wed, 2012-12-12 at 00:15 -0500, David Miller wrote: > From: Cyril Roelandt <tipecaml@gmail.com> > Date: Wed, 12 Dec 2012 01:24:53 +0100 > > > The ptp_clock_register() returns ERR_PTR() and never returns NULL. Replace the > > NULL check by a call to IS_ERR(). > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > I'll let Ben queue this up. > > Probably he'll want to avoid potentially leaving an ERR_PTR > in ptp->phc_clock even if, with this fix, that would be > harmless. Sorry for the delay in looking at this. This change is fine, as the entire structure *ptp will be freed on the failure path. I'm now on vacation until the new year. Cyril, please re-send your patch with the addition of: Acked-by: Ben Hutchings <bhutchings@solarflare.com> so it will show up on 'patchwork' again and David can apply it from there. Ben. -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <1355271894-5284-1-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH 5/5] spi: fix return value check in hspi_probe(). [not found] ` <1355271894-5284-1-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2012-12-12 0:24 ` Cyril Roelandt [not found] ` <1355271894-5284-6-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Cyril Roelandt @ 2012-12-12 0:24 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Cyril Roelandt According to its documentation, clk_get() returns a "valid IS_ERR() condition containing errno", so we should call IS_ERR() rather than a NULL check. Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> --- drivers/spi/spi-sh-hspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 32f7b55..60cfae5 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c @@ -290,7 +290,7 @@ static int hspi_probe(struct platform_device *pdev) } clk = clk_get(NULL, "shyway_clk"); - if (!clk) { + if (IS_ERR(clk)) { dev_err(&pdev->dev, "shyway_clk is required\n"); ret = -EINVAL; goto error0; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
[parent not found: <1355271894-5284-6-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). [not found] ` <1355271894-5284-6-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2012-12-12 0:36 ` Kuninori Morimoto [not found] ` <87txrsqf7f.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Kuninori Morimoto @ 2012-12-12 0:36 UTC (permalink / raw) To: Cyril Roelandt Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Hi > According to its documentation, clk_get() returns a "valid IS_ERR() condition > containing errno", so we should call IS_ERR() rather than a NULL check. > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > --- > drivers/spi/spi-sh-hspi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c > index 32f7b55..60cfae5 100644 > --- a/drivers/spi/spi-sh-hspi.c > +++ b/drivers/spi/spi-sh-hspi.c > @@ -290,7 +290,7 @@ static int hspi_probe(struct platform_device *pdev) > } > > clk = clk_get(NULL, "shyway_clk"); > - if (!clk) { > + if (IS_ERR(clk)) { > dev_err(&pdev->dev, "shyway_clk is required\n"); > ret = -EINVAL; > goto error0; > -- > 1.7.10.4 > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > _______________________________________________ > spi-devel-general mailing list > spi-devel-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/spi-devel-general Best regards --- Kuninori Morimoto ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <87txrsqf7f.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). [not found] ` <87txrsqf7f.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org> @ 2012-12-19 15:11 ` Grant Likely 2012-12-19 16:39 ` Dan Carpenter 0 siblings, 1 reply; 17+ messages in thread From: Grant Likely @ 2012-12-19 15:11 UTC (permalink / raw) To: Kuninori Morimoto, Cyril Roelandt Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > Hi > > > According to its documentation, clk_get() returns a "valid IS_ERR() condition > > containing errno", so we should call IS_ERR() rather than a NULL check. > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Applied, thanks. g. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). 2012-12-19 15:11 ` Grant Likely @ 2012-12-19 16:39 ` Dan Carpenter 2012-12-22 9:56 ` Grant Likely 0 siblings, 1 reply; 17+ messages in thread From: Dan Carpenter @ 2012-12-19 16:39 UTC (permalink / raw) To: Grant Likely Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Cyril Roelandt, Kuninori Morimoto, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Wed, Dec 19, 2012 at 03:11:54PM +0000, Grant Likely wrote: > On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > > > Hi > > > > > According to its documentation, clk_get() returns a "valid IS_ERR() condition > > > containing errno", so we should call IS_ERR() rather than a NULL check. > > > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > Applied, thanks. In another thread, we were just talking about who clk_get() can return a NULL if !CONFIG_HAVE_CLK. That might change to match the documentation later... Not sure. regards, dan carpenter ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). 2012-12-19 16:39 ` Dan Carpenter @ 2012-12-22 9:56 ` Grant Likely 2013-01-03 16:04 ` Dan Carpenter 0 siblings, 1 reply; 17+ messages in thread From: Grant Likely @ 2012-12-22 9:56 UTC (permalink / raw) To: Dan Carpenter Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Cyril Roelandt, Kuninori Morimoto, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Wed, 19 Dec 2012 19:39:14 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote: > On Wed, Dec 19, 2012 at 03:11:54PM +0000, Grant Likely wrote: > > On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > > > > > Hi > > > > > > > According to its documentation, clk_get() returns a "valid IS_ERR() condition > > > > containing errno", so we should call IS_ERR() rather than a NULL check. > > > > > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > > > > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > > > Applied, thanks. > > In another thread, we were just talking about who clk_get() can > return a NULL if !CONFIG_HAVE_CLK. That might change to match the > documentation later... Not sure. So what is the solution here? Will the dummy clk_get() be changed, or is there more work needed on the drivers? /me stifles a rant about the PTR_ERR pattern g. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). 2012-12-22 9:56 ` Grant Likely @ 2013-01-03 16:04 ` Dan Carpenter 2013-01-11 15:02 ` Grant Likely 0 siblings, 1 reply; 17+ messages in thread From: Dan Carpenter @ 2013-01-03 16:04 UTC (permalink / raw) To: Grant Likely Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Cyril Roelandt, Kuninori Morimoto, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Sat, Dec 22, 2012 at 09:56:20AM +0000, Grant Likely wrote: > On Wed, 19 Dec 2012 19:39:14 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > On Wed, Dec 19, 2012 at 03:11:54PM +0000, Grant Likely wrote: > > > On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > > > > > > > Hi > > > > > > > > > According to its documentation, clk_get() returns a "valid IS_ERR() condition > > > > > containing errno", so we should call IS_ERR() rather than a NULL check. > > > > > > > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > > > > > > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > > > > > Applied, thanks. > > > > In another thread, we were just talking about who clk_get() can > > return a NULL if !CONFIG_HAVE_CLK. That might change to match the > > documentation later... Not sure. > > So what is the solution here? Will the dummy clk_get() be changed, or is > there more work needed on the drivers? > This driver can't function without a clk. It should select that at build time instead of testing for it at probe. Just checking for IS_ERR() will NOT cause a NULL dereference so the patch is ok in that respect. I'm not sure if this can be build without CONFIG_HAVE_CLK. regards, dan carpenter ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). 2013-01-03 16:04 ` Dan Carpenter @ 2013-01-11 15:02 ` Grant Likely 2013-01-12 0:01 ` Dan Carpenter 0 siblings, 1 reply; 17+ messages in thread From: Grant Likely @ 2013-01-11 15:02 UTC (permalink / raw) To: Dan Carpenter Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Cyril Roelandt, Kuninori Morimoto, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Thu, 3 Jan 2013 19:04:55 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote: > On Sat, Dec 22, 2012 at 09:56:20AM +0000, Grant Likely wrote: > > On Wed, 19 Dec 2012 19:39:14 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > > On Wed, Dec 19, 2012 at 03:11:54PM +0000, Grant Likely wrote: > > > > On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > > > > > > > > > Hi > > > > > > > > > > > According to its documentation, clk_get() returns a "valid IS_ERR() condition > > > > > > containing errno", so we should call IS_ERR() rather than a NULL check. > > > > > > > > > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > > > > > > > > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > > > > > > > Applied, thanks. > > > > > > In another thread, we were just talking about who clk_get() can > > > return a NULL if !CONFIG_HAVE_CLK. That might change to match the > > > documentation later... Not sure. > > > > So what is the solution here? Will the dummy clk_get() be changed, or is > > there more work needed on the drivers? > > > > This driver can't function without a clk. It should select that at > build time instead of testing for it at probe. Just checking for > IS_ERR() will NOT cause a NULL dereference so the patch is ok in > that respect. I'm not sure if this can be build without > CONFIG_HAVE_CLK. Your suggestion is to make this driver depend on CONFIG_HAVE_CLK? I'm fine with that, but it doesn't sort out the core infrastructure question about whether it is valid for the empty clk_get() to return NULL. Nor is it a particularly sustainable solution (ie. if a large number of drivers want to do the same thing). g. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] spi: fix return value check in hspi_probe(). 2013-01-11 15:02 ` Grant Likely @ 2013-01-12 0:01 ` Dan Carpenter 0 siblings, 0 replies; 17+ messages in thread From: Dan Carpenter @ 2013-01-12 0:01 UTC (permalink / raw) To: Grant Likely Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Cyril Roelandt, Kuninori Morimoto, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Fri, Jan 11, 2013 at 03:02:02PM +0000, Grant Likely wrote: > On Thu, 3 Jan 2013 19:04:55 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > On Sat, Dec 22, 2012 at 09:56:20AM +0000, Grant Likely wrote: > > > On Wed, 19 Dec 2012 19:39:14 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote: > > > > On Wed, Dec 19, 2012 at 03:11:54PM +0000, Grant Likely wrote: > > > > > On Tue, 11 Dec 2012 16:36:27 -0800 (PST), Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > > > > > > > > > > > Hi > > > > > > > > > > > > > According to its documentation, clk_get() returns a "valid IS_ERR() condition > > > > > > > containing errno", so we should call IS_ERR() rather than a NULL check. > > > > > > > > > > > > > > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> > > > > > > > > > > > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > > > > > > > > > Applied, thanks. > > > > > > > > In another thread, we were just talking about who clk_get() can > > > > return a NULL if !CONFIG_HAVE_CLK. That might change to match the > > > > documentation later... Not sure. > > > > > > So what is the solution here? Will the dummy clk_get() be changed, or is > > > there more work needed on the drivers? > > > > > > > This driver can't function without a clk. It should select that at > > build time instead of testing for it at probe. Just checking for > > IS_ERR() will NOT cause a NULL dereference so the patch is ok in > > that respect. I'm not sure if this can be build without > > CONFIG_HAVE_CLK. > > Your suggestion is to make this driver depend on CONFIG_HAVE_CLK? I'm > fine with that, but it doesn't sort out the core infrastructure question > about whether it is valid for the empty clk_get() to return NULL. Nor is > it a particularly sustainable solution (ie. if a large number of drivers > want to do the same thing). > We've spread this conversation out across several different threads. http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/139186.html Basically, drivers should use accessor functions which handle NULL pointers instead of dereferencing the pointer directly. regards, dan carpenter ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2013-01-12 0:01 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12 0:24 [PATCH 0/5] Use IS_ERR() rather than a NULL check when necessary Cyril Roelandt
2012-12-12 0:24 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_therm Cyril Roelandt
2012-12-12 6:51 ` [PATCH 1/5] staging: omap-thermal: fix error check in omap_thermal_expose_sensor() and in omap_t Eduardo Valentin
2012-12-12 0:24 ` [PATCH 2/5] media: davinci: fix return value check in vpbe_display_reqbufs() Cyril Roelandt
2012-12-12 5:22 ` Prabhakar Lad
2012-12-12 0:24 ` [PATCH 3/5] c2port: fix return value check in duramar2150_c2port_init() Cyril Roelandt
2012-12-12 0:24 ` [PATCH 4/5] net: sfc: fix return value check in efx_ptp_probe_channel() Cyril Roelandt
2012-12-12 5:15 ` David Miller
2012-12-21 3:09 ` Ben Hutchings
[not found] ` <1355271894-5284-1-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-12 0:24 ` [PATCH 5/5] spi: fix return value check in hspi_probe() Cyril Roelandt
[not found] ` <1355271894-5284-6-git-send-email-tipecaml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-12 0:36 ` Kuninori Morimoto
[not found] ` <87txrsqf7f.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-12-19 15:11 ` Grant Likely
2012-12-19 16:39 ` Dan Carpenter
2012-12-22 9:56 ` Grant Likely
2013-01-03 16:04 ` Dan Carpenter
2013-01-11 15:02 ` Grant Likely
2013-01-12 0:01 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox