mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] state: only build circular backend if MTD is enabled
@ 2016-07-22 13:00 Lucas Stach
  2016-07-22 13:00 ` [PATCH 2/3] commands: fbtest: select IMAGE_RENDERER Lucas Stach
  2016-07-22 13:00 ` [PATCH 3/3] nand: mrvl: don't double cast error pointer Lucas Stach
  0 siblings, 2 replies; 5+ messages in thread
From: Lucas Stach @ 2016-07-22 13:00 UTC (permalink / raw)
  To: barebox

The circular backend depends on MTD symbols and is only useful
if MTD is present. Exclude it from the build if MTD is not enabled.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 common/state/Makefile          | 2 +-
 common/state/backend_storage.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/state/Makefile b/common/state/Makefile
index 23f72862b995..3e0e2c6e5516 100644
--- a/common/state/Makefile
+++ b/common/state/Makefile
@@ -5,5 +5,5 @@ obj-y += backend_format_dtb.o
 obj-y += backend_format_raw.o
 obj-y += backend_storage.o
 obj-y += backend_bucket_direct.o
-obj-y += backend_bucket_circular.o
+obj-$(CONFIG_MTD) += backend_bucket_circular.o
 obj-y += backend_bucket_cached.o
diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index c4508a8aba67..5dc8c5026733 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -471,7 +471,7 @@ int state_storage_init(struct state_backend_storage *storage,
 		       off_t offset, size_t max_size, uint32_t stridesize,
 		       const char *storagetype)
 {
-	int ret;
+	int ret = -ENODEV;
 	struct mtd_info_user meminfo;
 
 	INIT_LIST_HEAD(&storage->buckets);
@@ -479,7 +479,9 @@ int state_storage_init(struct state_backend_storage *storage,
 	storage->name = storagetype;
 	storage->stridesize = stridesize;
 
-	ret = mtd_get_meminfo(path, &meminfo);
+	if (IS_ENABLED(CONFIG_MTD))
+		ret = mtd_get_meminfo(path, &meminfo);
+
 	if (!ret && !(meminfo.flags & MTD_NO_ERASE)) {
 		bool non_circular = false;
 		if (!storagetype) {
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] commands: fbtest: select IMAGE_RENDERER
  2016-07-22 13:00 [PATCH 1/3] state: only build circular backend if MTD is enabled Lucas Stach
@ 2016-07-22 13:00 ` Lucas Stach
  2016-07-22 13:00 ` [PATCH 3/3] nand: mrvl: don't double cast error pointer Lucas Stach
  1 sibling, 0 replies; 5+ messages in thread
From: Lucas Stach @ 2016-07-22 13:00 UTC (permalink / raw)
  To: barebox

2D_PRIMITIVES needs IMAGE_RENDERER.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 commands/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/commands/Kconfig b/commands/Kconfig
index 3a0977b9806b..17020b2401d8 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1421,6 +1421,7 @@ config CMD_FBTEST
 	bool
 	depends on VIDEO
 	select 2D_PRIMITIVES
+	select IMAGE_RENDERER
 	prompt "FB test"
 	help
 	  Framebuffer test command that allows to produce a number of
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] nand: mrvl: don't double cast error pointer
  2016-07-22 13:00 [PATCH 1/3] state: only build circular backend if MTD is enabled Lucas Stach
  2016-07-22 13:00 ` [PATCH 2/3] commands: fbtest: select IMAGE_RENDERER Lucas Stach
@ 2016-07-22 13:00 ` Lucas Stach
  2016-07-25  8:20   ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Lucas Stach @ 2016-07-22 13:00 UTC (permalink / raw)
  To: barebox

Fixes:
In function 'alloc_nand_resource':
warning: return makes pointer from integer without a cast

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/mtd/nand/nand_mrvl_nfc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c
index 578790da2612..1341f084d8f8 100644
--- a/drivers/mtd/nand/nand_mrvl_nfc.c
+++ b/drivers/mtd/nand/nand_mrvl_nfc.c
@@ -1138,7 +1138,7 @@ static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev)
 	host->dev = dev;
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores))
-		return PTR_ERR(iores);
+		return iores;
 	host->mmio_base = IOMEM(iores->start);
 	if (IS_ERR(host->mmio_base)) {
 		free(host);
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] nand: mrvl: don't double cast error pointer
  2016-07-22 13:00 ` [PATCH 3/3] nand: mrvl: don't double cast error pointer Lucas Stach
@ 2016-07-25  8:20   ` Sascha Hauer
  2016-07-25  8:27     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2016-07-25  8:20 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Fri, Jul 22, 2016 at 03:00:21PM +0200, Lucas Stach wrote:
> Fixes:
> In function 'alloc_nand_resource':
> warning: return makes pointer from integer without a cast
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/mtd/nand/nand_mrvl_nfc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c
> index 578790da2612..1341f084d8f8 100644
> --- a/drivers/mtd/nand/nand_mrvl_nfc.c
> +++ b/drivers/mtd/nand/nand_mrvl_nfc.c
> @@ -1138,7 +1138,7 @@ static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev)
>  	host->dev = dev;
>  	iores = dev_request_mem_resource(dev, 0);
>  	if (IS_ERR(iores))
> -		return PTR_ERR(iores);
> +		return iores;

Better use ERR_CAST() here. It makes it more explicit that an error is
returned here.

Sascha

>  	host->mmio_base = IOMEM(iores->start);
>  	if (IS_ERR(host->mmio_base)) {
>  		free(host);
> -- 
> 2.8.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] nand: mrvl: don't double cast error pointer
  2016-07-25  8:20   ` Sascha Hauer
@ 2016-07-25  8:27     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2016-07-25  8:27 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Mon, Jul 25, 2016 at 10:20:59AM +0200, Sascha Hauer wrote:
> On Fri, Jul 22, 2016 at 03:00:21PM +0200, Lucas Stach wrote:
> > Fixes:
> > In function 'alloc_nand_resource':
> > warning: return makes pointer from integer without a cast
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  drivers/mtd/nand/nand_mrvl_nfc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c
> > index 578790da2612..1341f084d8f8 100644
> > --- a/drivers/mtd/nand/nand_mrvl_nfc.c
> > +++ b/drivers/mtd/nand/nand_mrvl_nfc.c
> > @@ -1138,7 +1138,7 @@ static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev)
> >  	host->dev = dev;
> >  	iores = dev_request_mem_resource(dev, 0);
> >  	if (IS_ERR(iores))
> > -		return PTR_ERR(iores);
> > +		return iores;
> 
> Better use ERR_CAST() here. It makes it more explicit that an error is
> returned here.

Just saw there are some more places that could use ERR_CAST. I sent an
alternative patch.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-25  8:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22 13:00 [PATCH 1/3] state: only build circular backend if MTD is enabled Lucas Stach
2016-07-22 13:00 ` [PATCH 2/3] commands: fbtest: select IMAGE_RENDERER Lucas Stach
2016-07-22 13:00 ` [PATCH 3/3] nand: mrvl: don't double cast error pointer Lucas Stach
2016-07-25  8:20   ` Sascha Hauer
2016-07-25  8:27     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox