* [PATCH] mtd: nand: assign mtd->name in find_full_id_nand @ 2013-12-26 1:51 Caizhiyong 2013-12-26 2:19 ` Huang Shijie 0 siblings, 1 reply; 5+ messages in thread From: Caizhiyong @ 2013-12-26 1:51 UTC (permalink / raw) To: linux-mtd Cc: Brian Norris, Wanglin (Albert), Huang Shijie, David Woodhouse, linux-kernel, Artem Bityutskiy From: Cai Zhiyong <caizhiyong@huawei.com> Date: Wed, 25 Dec 2013 21:19:21 +0800 Subject: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand This patch assigned the type->name to mtd->name when mtd->name is NULL in function "find_full_id_nand". mtd->name is NULL may cause some problem. Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> --- drivers/mtd/nand/nand_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 9b3bb3c..404e83d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3327,6 +3327,9 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, *busw = type->options & NAND_BUSWIDTH_16; + if (!mtd->name) + mtd->name = type->name; + return true; } return false; -- 1.8.1.5 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand 2013-12-26 1:51 [PATCH] mtd: nand: assign mtd->name in find_full_id_nand Caizhiyong @ 2013-12-26 2:19 ` Huang Shijie 2014-01-11 20:10 ` Brian Norris 0 siblings, 1 reply; 5+ messages in thread From: Huang Shijie @ 2013-12-26 2:19 UTC (permalink / raw) To: Caizhiyong Cc: linux-mtd, Brian Norris, Wanglin (Albert), David Woodhouse, linux-kernel, Artem Bityutskiy On Thu, Dec 26, 2013 at 01:51:58AM +0000, Caizhiyong wrote: > From: Cai Zhiyong <caizhiyong@huawei.com> > Date: Wed, 25 Dec 2013 21:19:21 +0800 > Subject: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand > > This patch assigned the type->name to mtd->name when mtd->name is > NULL in function "find_full_id_nand". > mtd->name is NULL may cause some problem. > > Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> > --- > drivers/mtd/nand/nand_base.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index 9b3bb3c..404e83d 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -3327,6 +3327,9 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, > > *busw = type->options & NAND_BUSWIDTH_16; > > + if (!mtd->name) > + mtd->name = type->name; > + > return true; > } > return false; Acked-by: Huang Shijie <b32955@freescale.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand 2013-12-26 2:19 ` Huang Shijie @ 2014-01-11 20:10 ` Brian Norris 2014-01-13 4:12 ` Caizhiyong 0 siblings, 1 reply; 5+ messages in thread From: Brian Norris @ 2014-01-11 20:10 UTC (permalink / raw) To: Huang Shijie, Caizhiyong Cc: linux-mtd, Wanglin (Albert), David Woodhouse, linux-kernel, Artem Bityutskiy Hi, On Thu, Dec 26, 2013 at 10:19:39AM +0800, Huang Shijie wrote: > On Thu, Dec 26, 2013 at 01:51:58AM +0000, Caizhiyong wrote: > > From: Cai Zhiyong <caizhiyong@huawei.com> > > Date: Wed, 25 Dec 2013 21:19:21 +0800 > > Subject: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand > > > > This patch assigned the type->name to mtd->name when mtd->name is > > NULL in function "find_full_id_nand". > > mtd->name is NULL may cause some problem. > > > > Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> > Acked-by: Huang Shijie <b32955@freescale.com> Thanks, the patch looks good. Pushed to l2-mtd.git. Wouldn't this trigger an exception when reading /sys/class/mtd/mtdX/name? If so, should this be marked for stable? Brian ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand 2014-01-11 20:10 ` Brian Norris @ 2014-01-13 4:12 ` Caizhiyong 2014-01-13 7:46 ` Brian Norris 0 siblings, 1 reply; 5+ messages in thread From: Caizhiyong @ 2014-01-13 4:12 UTC (permalink / raw) To: Brian Norris, Huang Shijie Cc: linux-mtd, Wanglin (Albert), David Woodhouse, linux-kernel, Artem Bityutskiy, Quyaxin > -----Original Message----- > From: Brian Norris [mailto:computersforpeace@gmail.com] > Sent: Sunday, January 12, 2014 4:10 AM > To: Huang Shijie; Caizhiyong > Cc: linux-mtd@lists.infradead.org; Wanglin (Albert); David Woodhouse; > linux-kernel@vger.kernel.org; Artem Bityutskiy > Subject: Re: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand > > Hi, > > On Thu, Dec 26, 2013 at 10:19:39AM +0800, Huang Shijie wrote: > > On Thu, Dec 26, 2013 at 01:51:58AM +0000, Caizhiyong wrote: > > > From: Cai Zhiyong <caizhiyong@huawei.com> > > > Date: Wed, 25 Dec 2013 21:19:21 +0800 > > > Subject: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand > > > > > > This patch assigned the type->name to mtd->name when mtd->name is > > > NULL in function "find_full_id_nand". > > > mtd->name is NULL may cause some problem. > > > > > > Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> > > Acked-by: Huang Shijie <b32955@freescale.com> > > Thanks, the patch looks good. Pushed to l2-mtd.git. > > Wouldn't this trigger an exception when reading > /sys/class/mtd/mtdX/name? If so, should this be marked for stable? View the source code, if mtd->name is NULL, cat "/sys/class/mtd/mtdX/name" will get string "(null)". static ssize_t mtd_name_show(struct device *dev, struct device_attribute *attr, char *buf) { struct mtd_info *mtd = dev_get_drvdata(dev); return snprintf(buf, PAGE_SIZE, "%s\n", mtd->name); } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand 2014-01-13 4:12 ` Caizhiyong @ 2014-01-13 7:46 ` Brian Norris 0 siblings, 0 replies; 5+ messages in thread From: Brian Norris @ 2014-01-13 7:46 UTC (permalink / raw) To: Caizhiyong Cc: Huang Shijie, linux-mtd, Wanglin (Albert), David Woodhouse, linux-kernel, Artem Bityutskiy, Quyaxin On Mon, Jan 13, 2014 at 04:12:45AM +0000, Caizhiyong wrote: > > -----Original Message----- > > From: Brian Norris [mailto:computersforpeace@gmail.com] > > Sent: Sunday, January 12, 2014 4:10 AM > > > > On Thu, Dec 26, 2013 at 10:19:39AM +0800, Huang Shijie wrote: > > > On Thu, Dec 26, 2013 at 01:51:58AM +0000, Caizhiyong wrote: > > > > From: Cai Zhiyong <caizhiyong@huawei.com> > > > > Date: Wed, 25 Dec 2013 21:19:21 +0800 > > > > Subject: [PATCH] mtd: nand: assign mtd->name in find_full_id_nand > > > > > > > > This patch assigned the type->name to mtd->name when mtd->name is > > > > NULL in function "find_full_id_nand". > > > > mtd->name is NULL may cause some problem. > > > > > > > > Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> > > > Acked-by: Huang Shijie <b32955@freescale.com> > > > > Thanks, the patch looks good. Pushed to l2-mtd.git. > > > > Wouldn't this trigger an exception when reading > > /sys/class/mtd/mtdX/name? If so, should this be marked for stable? > > View the source code, if mtd->name is NULL, cat "/sys/class/mtd/mtdX/name" will get string "(null)". > > static ssize_t mtd_name_show(struct device *dev, struct device_attribute *attr, char *buf) > { > struct mtd_info *mtd = dev_get_drvdata(dev); > > return snprintf(buf, PAGE_SIZE, "%s\n", mtd->name); > } Thanks, I forgot that the kernel's printf-like functions handle NULL pointers gracefully. In that case, this probably doesn't need to be in -stable. Brian ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-13 7:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-12-26 1:51 [PATCH] mtd: nand: assign mtd->name in find_full_id_nand Caizhiyong 2013-12-26 2:19 ` Huang Shijie 2014-01-11 20:10 ` Brian Norris 2014-01-13 4:12 ` Caizhiyong 2014-01-13 7:46 ` Brian Norris
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®